Class: Aptible::CLI::Formatter::List

Inherits:
Node
  • Object
show all
Defined in:
lib/aptible/cli/formatter/list.rb

Direct Known Subclasses

KeyedList

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeList

Returns a new instance of List.



7
8
9
# File 'lib/aptible/cli/formatter/list.rb', line 7

def initialize
  @children = []
end

Instance Attribute Details

#childrenObject (readonly)

Returns the value of attribute children.



5
6
7
# File 'lib/aptible/cli/formatter/list.rb', line 5

def children
  @children
end

Instance Method Details

#list {|l| ... } ⇒ Object

Yields:

  • (l)


24
25
26
27
28
29
# File 'lib/aptible/cli/formatter/list.rb', line 24

def list
  l = List.new
  yield l
  @children << l
  nil
end

#object {|o| ... } ⇒ Object

Yields:

  • (o)


17
18
19
20
21
22
# File 'lib/aptible/cli/formatter/list.rb', line 17

def object
  o = Object.new
  yield o
  @children << o
  nil
end

#value(s) ⇒ Object



11
12
13
14
15
# File 'lib/aptible/cli/formatter/list.rb', line 11

def value(s)
  # TODO: Fail if block?
  @children << Value.new(s)
  nil
end