Class: YamlTranslator::KeyPath

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml-translator/key_path.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeKeyPath

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

#keysObject (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

#currentObject



17
18
19
# File 'lib/yaml-translator/key_path.rb', line 17

def current
  @keys.join('.')
end

#leaveObject



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_sObject



21
22
23
# File 'lib/yaml-translator/key_path.rb', line 21

def to_s
  current
end