Module: Datagrid::Core::InstanceMethods
- Defined in:
- lib/datagrid/core.rb
Overview
ClassMethods
Instance Method Summary collapse
- #[](attribute) ⇒ Object
- #[]=(attribute, value) ⇒ Object
- #assets ⇒ Object
- #attributes ⇒ Object
- #attributes=(attributes) ⇒ Object
- #initialize(attributes = nil) ⇒ Object
- #paginate(*args, &block) ⇒ Object
- #scope ⇒ Object
Instance Method Details
#[](attribute) ⇒ Object
71 72 73 |
# File 'lib/datagrid/core.rb', line 71 def [](attribute) self.send(attribute) end |
#[]=(attribute, value) ⇒ Object
75 76 77 |
# File 'lib/datagrid/core.rb', line 75 def []=(attribute, value) self.send(:"#{attribute}=", value) end |
#assets ⇒ Object
79 80 81 |
# File 'lib/datagrid/core.rb', line 79 def assets scope.scoped({}) end |
#attributes ⇒ Object
63 64 65 66 67 68 69 |
# File 'lib/datagrid/core.rb', line 63 def attributes result = {} self.class.datagrid_attributes.each do |name| result[name] = self[name] end result end |
#attributes=(attributes) ⇒ Object
83 84 85 86 87 |
# File 'lib/datagrid/core.rb', line 83 def attributes=(attributes) attributes.each do |name, value| self[name] = value end end |
#initialize(attributes = nil) ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/datagrid/core.rb', line 55 def initialize(attributes = nil) super() if attributes self.attributes = attributes end end |
#paginate(*args, &block) ⇒ Object
89 90 91 |
# File 'lib/datagrid/core.rb', line 89 def paginate(*args, &block) self.assets.paginate(*args, &block) end |
#scope ⇒ Object
93 94 95 |
# File 'lib/datagrid/core.rb', line 93 def scope self.class.scope end |