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