Class: ApiBuilder::ArrayRenderer

Inherits:
Object
  • Object
show all
Defined in:
lib/api_builder/renderer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ ArrayRenderer

Returns a new instance of ArrayRenderer.



10
11
12
13
# File 'lib/api_builder/renderer.rb', line 10

def initialize(*args, &block)
  @out = []
  instance_eval(&block)
end

Instance Attribute Details

#outObject (readonly)

Returns the value of attribute out.



8
9
10
# File 'lib/api_builder/renderer.rb', line 8

def out
  @out
end

Class Method Details

.render(*args, &block) ⇒ Object



3
4
5
6
# File 'lib/api_builder/renderer.rb', line 3

def self.render(*args, &block)
  renderer = self.new(*args, &block)
  renderer.out
end

Instance Method Details

#array(*args, &block) ⇒ Object



19
20
21
# File 'lib/api_builder/renderer.rb', line 19

def array(*args, &block)
  @out << ArrayRenderer.render(*args, &block)
end

#element(*args, &block) ⇒ Object



15
16
17
# File 'lib/api_builder/renderer.rb', line 15

def element(*args, &block)
  @out << ElementRenderer.render(*args, &block)
end