Class: TarvitHelpers::HashPresenter::Simple
- Inherits:
-
Object
- Object
- TarvitHelpers::HashPresenter::Simple
- Defined in:
- lib/tarvit-helpers/modules/hash_presenter/simple.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#_hash ⇒ Object
readonly
Returns the value of attribute _hash.
-
#_levels ⇒ Object
readonly
Returns the value of attribute _levels.
-
#_parent ⇒ Object
readonly
Returns the value of attribute _parent.
Instance Method Summary collapse
- #_root? ⇒ Boolean
-
#initialize(hash, levels = [], parent = nil) ⇒ Simple
constructor
A new instance of Simple.
- #method_missing(m, *args) ⇒ Object
Constructor Details
#initialize(hash, levels = [], parent = nil) ⇒ Simple
Returns a new instance of Simple.
9 10 11 12 13 |
# File 'lib/tarvit-helpers/modules/hash_presenter/simple.rb', line 9 def initialize(hash, levels=[], parent=nil) @_hash = _modify_hash(_prepare_keys(hash)) @_levels = levels @_parent = parent end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args) ⇒ Object
19 20 21 22 |
# File 'lib/tarvit-helpers/modules/hash_presenter/simple.rb', line 19 def method_missing(m, *args) return _value(m) if _accessor_method?(m) super end |
Instance Attribute Details
#_hash ⇒ Object (readonly)
Returns the value of attribute _hash.
7 8 9 |
# File 'lib/tarvit-helpers/modules/hash_presenter/simple.rb', line 7 def _hash @_hash end |
#_levels ⇒ Object (readonly)
Returns the value of attribute _levels.
7 8 9 |
# File 'lib/tarvit-helpers/modules/hash_presenter/simple.rb', line 7 def _levels @_levels end |
#_parent ⇒ Object (readonly)
Returns the value of attribute _parent.
7 8 9 |
# File 'lib/tarvit-helpers/modules/hash_presenter/simple.rb', line 7 def _parent @_parent end |
Instance Method Details
#_root? ⇒ Boolean
15 16 17 |
# File 'lib/tarvit-helpers/modules/hash_presenter/simple.rb', line 15 def _root? _parent.nil? end |