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.
62 63 64 |
# File 'lib/utils/schema_model.rb', line 62 def changed_attributes @changed_attributes end |
Instance Method Details
#errors ⇒ Object
70 71 72 |
# File 'lib/utils/schema_model.rb', line 70 def errors check definition, self end |
#initialize(attrs = {}) ⇒ Object
64 65 66 67 68 |
# File 'lib/utils/schema_model.rb', line 64 def initialize(attrs = {}) attrs.each do |attr, v| send("#{attr}=", v) end end |
#to_json ⇒ Object
78 79 80 81 82 83 |
# File 'lib/utils/schema_model.rb', line 78 def to_json return nil unless changed_attributes Hash[ changed_attributes.map { |attr| serialize_attr(attr) } ] end |
#valid? ⇒ Boolean
74 75 76 |
# File 'lib/utils/schema_model.rb', line 74 def valid? errors.empty? end |