Class: ViewModel::Metadata
- Inherits:
-
Struct
- Object
- Struct
- ViewModel::Metadata
- Defined in:
- lib/view_model.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#migrated ⇒ Object
Returns the value of attribute migrated.
-
#new ⇒ Object
Returns the value of attribute new.
-
#schema_version ⇒ Object
Returns the value of attribute schema_version.
-
#view_name ⇒ Object
Returns the value of attribute view_name.
Instance Method Summary collapse
-
#auto_child_update? ⇒ Boolean
Does this child metadata describe an create-or-update to the anonymous child of a singular association.
-
#child_update? ⇒ Boolean
Does this metadata describe an change to the anonymous child of a singular association.
-
#explicit_child_update? ⇒ Boolean
Does this metadata describe an update to the already-existing anonymous child of a singular association.
-
#new? ⇒ Boolean
Does this metadata describe deserialization to a new model, either by true or nil, id: nil.
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id
41 42 43 |
# File 'lib/view_model.rb', line 41 def id @id end |
#migrated ⇒ Object
Returns the value of attribute migrated
41 42 43 |
# File 'lib/view_model.rb', line 41 def migrated @migrated end |
#new ⇒ Object
Returns the value of attribute new
41 42 43 |
# File 'lib/view_model.rb', line 41 def new @new end |
#schema_version ⇒ Object
Returns the value of attribute schema_version
41 42 43 |
# File 'lib/view_model.rb', line 41 def schema_version @schema_version end |
#view_name ⇒ Object
Returns the value of attribute view_name
41 42 43 |
# File 'lib/view_model.rb', line 41 def view_name @view_name end |
Instance Method Details
#auto_child_update? ⇒ Boolean
Does this child metadata describe an create-or-update to the anonymous child of a singular association
66 67 68 |
# File 'lib/view_model.rb', line 66 def auto_child_update? new == 'auto' end |
#child_update? ⇒ Boolean
Does this metadata describe an change to the anonymous child of a singular association
54 55 56 |
# File 'lib/view_model.rb', line 54 def child_update? explicit_child_update? || auto_child_update? end |
#explicit_child_update? ⇒ Boolean
Does this metadata describe an update to the already-existing anonymous child of a singular association
60 61 62 |
# File 'lib/view_model.rb', line 60 def explicit_child_update? new == false && id.nil? end |
#new? ⇒ Boolean
Does this metadata describe deserialization to a new model, either by true or nil, id: nil
44 45 46 47 48 49 50 |
# File 'lib/view_model.rb', line 44 def new? if new.nil? id.nil? else new == true end end |