Class: Dillo::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/dillo.rb

Direct Known Subclasses

Column, View

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Record

Returns a new instance of Record.



172
173
174
# File 'lib/dillo.rb', line 172

def initialize(attributes)
  self.attributes = attributes
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



184
185
186
187
188
189
190
# File 'lib/dillo.rb', line 184

def method_missing(method, *args, &block)
  if respond_to?(method)
    @attributes[method.to_s]
  else
    super
  end
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



170
171
172
# File 'lib/dillo.rb', line 170

def attributes
  @attributes
end

Instance Method Details

#inspectObject



192
193
194
# File 'lib/dillo.rb', line 192

def inspect
  "#<#{self.class.name}:#{id}>"
end

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


180
181
182
# File 'lib/dillo.rb', line 180

def respond_to?(method)
  @attributes.has_key?(method.to_s) || super
end