class Reynard::Model
Superclass for dynamic classes generated by the object builder.
Public Class Methods
new(attributes)
click to toggle source
# File lib/reynard/model.rb, line 6 def initialize(attributes) self.attributes = attributes end
Public Instance Methods
attributes=(attributes)
click to toggle source
# File lib/reynard/model.rb, line 10 def attributes=(attributes) attributes.each do |name, value| instance_variable_set("@#{name}", value) end end
method_missing(attribute_name, *)
click to toggle source
Until we can set accessors based on the schema
# File lib/reynard/model.rb, line 17 def method_missing(attribute_name, *) instance_variable_get("@#{attribute_name}") rescue NameError raise NoMethodError, "undefined method `#{attribute_name}' for #{inspect}" end
respond_to_missing?(attribute_name, *)
click to toggle source
# File lib/reynard/model.rb, line 23 def respond_to_missing?(attribute_name, *) !instance_variable_get("@#{attribute_name}").nil? rescue NameError false end