Class: ApiBuilder::ArrayRenderer
- Inherits:
-
Object
- Object
- ApiBuilder::ArrayRenderer
- Defined in:
- lib/api_builder/renderer.rb
Instance Attribute Summary collapse
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Class Method Summary collapse
Instance Method Summary collapse
- #array(*args, &block) ⇒ Object
- #element(*args, &block) ⇒ Object
-
#initialize(*args, &block) ⇒ ArrayRenderer
constructor
A new instance of ArrayRenderer.
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
#out ⇒ Object (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 |