Module: SchemaModel::InstanceMethods
- Defined in:
- lib/utils/schema_model.rb
Instance Attribute Summary collapse
-
#changed_attributes ⇒ Object
Returns the value of attribute changed_attributes.
Instance Method Summary collapse
Instance Attribute Details
#changed_attributes ⇒ Object
Returns the value of attribute changed_attributes.
64 65 66 |
# File 'lib/utils/schema_model.rb', line 64 def changed_attributes @changed_attributes end |
Instance Method Details
#errors ⇒ Object
72 73 74 |
# File 'lib/utils/schema_model.rb', line 72 def errors check definition, self end |
#initialize(attrs = {}) ⇒ Object
66 67 68 69 70 |
# File 'lib/utils/schema_model.rb', line 66 def initialize(attrs = {}) attrs.each do |attr, v| send("#{attr}=", v) end end |
#to_json ⇒ Object
80 81 82 83 84 85 |
# File 'lib/utils/schema_model.rb', line 80 def to_json return nil unless changed_attributes Hash[ changed_attributes.map { |attr| serialize_attr(attr) } ] end |
#valid? ⇒ Boolean
76 77 78 |
# File 'lib/utils/schema_model.rb', line 76 def valid? errors.empty? end |