Class: LHS::Item
- Includes:
- Create, Destroy, Save, Update, Validation
- Defined in:
- lib/lhs/item.rb,
lib/lhs/concerns/item/save.rb,
lib/lhs/concerns/item/update.rb,
lib/lhs/concerns/item/destroy.rb,
lib/lhs/concerns/item/validation.rb
Overview
An item is a concrete record. It can be part of another proxy like collection.
Defined Under Namespace
Modules: Destroy, Save, Update, Validation
Constant Summary
Constants included from Proxy::Accessors
Proxy::Accessors::BLACKLISTED_KEYWORDS
Instance Attribute Summary collapse
-
#errors ⇒ Object
prevent clashing with attributes of underlying data.
Attributes inherited from Proxy
Instance Method Summary collapse
- #collection? ⇒ Boolean
-
#initialize(data) ⇒ Item
constructor
A new instance of Item.
- #item? ⇒ Boolean
Methods included from Validation
Methods included from Update
Methods included from Save
Methods included from Destroy
Methods inherited from Proxy
Methods included from Proxy::Create
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &_block) ⇒ Object (protected)
35 36 37 38 |
# File 'lib/lhs/item.rb', line 35 def method_missing(name, *args, &_block) return set(name, args.try(&:first)) if name.to_s[/=$/] get(name, *args) end |
Instance Attribute Details
#errors ⇒ Object
prevent clashing with attributes of underlying data
16 17 18 |
# File 'lib/lhs/item.rb', line 16 def errors @errors end |
Instance Method Details
#collection? ⇒ Boolean
25 26 27 |
# File 'lib/lhs/item.rb', line 25 def collection? false end |
#item? ⇒ Boolean
29 30 31 |
# File 'lib/lhs/item.rb', line 29 def item? true end |