Class: Windy::Record

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

Direct Known Subclasses

Column, View

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Record



159
160
161
# File 'lib/windy.rb', line 159

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



171
172
173
174
175
176
177
# File 'lib/windy.rb', line 171

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.



157
158
159
# File 'lib/windy.rb', line 157

def attributes
  @attributes
end

Instance Method Details

#inspectObject



179
180
181
# File 'lib/windy.rb', line 179

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

#respond_to?(method) ⇒ Boolean



167
168
169
# File 'lib/windy.rb', line 167

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