Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdan committed Jan 17, 2024
1 parent 195861e commit d539bb4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
13 changes: 7 additions & 6 deletions lib/datagrid/core.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,9 @@ def self.included(base)
base.extend ClassMethods
base.class_eval do
class_attribute :scope_value

class_attribute :datagrid_attributes, instance_writer: false
self.datagrid_attributes = []

class_attribute :datagrid_attributes, instance_writer: false, default: []
class_attribute :dynamic_block, instance_writer: false
class_attribute :forbidden_attributes_protection, instance_writer: false
self.forbidden_attributes_protection = false
class_attribute :forbidden_attributes_protection, instance_writer: false, default: false
include ::ActiveModel::AttributeAssignment
end
base.include InstanceMethods
Expand Down Expand Up @@ -154,6 +150,11 @@ def attributes

# Updates datagrid attributes with a passed hash argument
# @param attributes [Hash<Symbol, Object>]
# @example
# grid = MyGrid.new
# grid.attributes = {first_name: 'John', last_name: 'Smith'}
# grid.first_name # => 'John'
# grid.last_name # => 'Smith'
def attributes=(attributes)
super(attributes)
end
Expand Down
3 changes: 1 addition & 2 deletions lib/datagrid/drivers/abstract_driver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ class AbstractDriver

TIMESTAMP_CLASSES = [DateTime, Time, ActiveSupport::TimeWithZone]

class_attribute :subclasses
class_attribute :subclasses, default: []

def self.inherited(base)
super(base)
self.subclasses ||= []
self.subclasses << base
end

Expand Down
3 changes: 1 addition & 2 deletions lib/datagrid/filters.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ def self.included(base)

include Datagrid::Core
include Datagrid::Filters::CompositeFilters
class_attribute :filters_array
self.filters_array = []
class_attribute :filters_array, default: []

end
base.include InstanceMethods
Expand Down

0 comments on commit d539bb4

Please sign in to comment.