Class: Ro::Collection::List

Inherits:
Array
  • Object
show all
Includes:
Klass
Defined in:
lib/ro/collection/list.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Klass

included

Constructor Details

#initialize(root) ⇒ List



8
9
10
11
# File 'lib/ro/collection/list.rb', line 8

def initialize(root, ...)
  @root = root
  super(...)
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



6
7
8
# File 'lib/ro/collection/list.rb', line 6

def root
  @root
end

Instance Method Details

#[](index) ⇒ Object



17
18
19
20
# File 'lib/ro/collection/list.rb', line 17

def [](index, ...)
  return get(index) if [String, Symbol].include?(index.class)
  super(index, ...)
end

#get(name) ⇒ Object



13
14
15
# File 'lib/ro/collection/list.rb', line 13

def get(name)
  @root.get(name)
end