Class: Hypostasis::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/hypostasis/key.rb

Instance Method Summary collapse

Constructor Details

#initialize(key_path, value = nil) ⇒ Key

Returns a new instance of Key.



2
3
4
# File 'lib/hypostasis/key.rb', line 2

def initialize(key_path, value = nil)
  @key_path = key_path
end

Instance Method Details

#[](index) ⇒ Object



14
15
16
# File 'lib/hypostasis/key.rb', line 14

def [](index)
  unpack_tuple(decomposed_key[index.to_i])
end

#firstObject



6
7
8
# File 'lib/hypostasis/key.rb', line 6

def first
  unpack_tuple(decomposed_key.first)
end

#lastObject



10
11
12
# File 'lib/hypostasis/key.rb', line 10

def last
  unpack_tuple(decomposed_key.last)
end