Class: YamlTranslator::KeyPath
- Inherits:
-
Object
- Object
- YamlTranslator::KeyPath
- Defined in:
- lib/yaml-translator/key_path.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
- #current ⇒ Object
-
#initialize ⇒ KeyPath
constructor
A new instance of KeyPath.
- #leave ⇒ Object
- #move_to(key) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ KeyPath
Returns a new instance of KeyPath.
5 6 7 |
# File 'lib/yaml-translator/key_path.rb', line 5 def initialize @keys = [] end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
3 4 5 |
# File 'lib/yaml-translator/key_path.rb', line 3 def keys @keys end |
Instance Method Details
#current ⇒ Object
17 18 19 |
# File 'lib/yaml-translator/key_path.rb', line 17 def current @keys.join('.') end |
#leave ⇒ Object
13 14 15 |
# File 'lib/yaml-translator/key_path.rb', line 13 def leave @keys.pop end |
#move_to(key) ⇒ Object
9 10 11 |
# File 'lib/yaml-translator/key_path.rb', line 9 def move_to(key) @keys.push(key) end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/yaml-translator/key_path.rb', line 21 def to_s current end |