Class: OptionsModel::Base
Class Method Summary
collapse
Instance Method Summary
collapse
#[], #[]=, #attributes, #fetch, #initialize, #initialize_dup, #nested_attributes, #unused_attributes, #update_attributes
#to_h
Class Method Details
.derive(name = "AnonymousRecord") ⇒ Object
43
44
45
46
47
48
|
# File 'lib/options_model/base.rb', line 43
def self.derive(name = "AnonymousRecord")
Class.new(self) do
include OptionsModel::Concerns::NameHacking
self.name = name
end
end
|
.inspect ⇒ Object
35
36
37
|
# File 'lib/options_model/base.rb', line 35
def self.inspect
"#<#{name}:OptionsModel [#{attribute_names.map(&:inspect).join(', ')}]>"
end
|
Instance Method Details
#==(other) ⇒ Object
Also known as:
eql?
19
20
21
22
23
24
|
# File 'lib/options_model/base.rb', line 19
def ==(other)
other.instance_of?(self.class) &&
attributes == other.attributes &&
nested_attributes == other.nested_attributes &&
unused_attributes == other.unused_attributes
end
|
#hash ⇒ Object
27
28
29
|
# File 'lib/options_model/base.rb', line 27
def hash
[attributes, nested_attributes, unused_attributes].hash
end
|
#inspect ⇒ Object
31
32
33
|
# File 'lib/options_model/base.rb', line 31
def inspect
"#<#{self.class.name}:OptionsModel #{self.to_h}>"
end
|
#persisted? ⇒ Boolean
39
40
41
|
# File 'lib/options_model/base.rb', line 39
def persisted?
true
end
|