Class: ApiSketch::DSL::Headers
- Defined in:
- lib/api_sketch/dsl/headers.rb
Instance Method Summary collapse
- #add(name, &block) ⇒ Object
-
#initialize(&block) ⇒ Headers
constructor
A new instance of Headers.
- #to_a ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(&block) ⇒ Headers
Returns a new instance of Headers.
3 4 5 6 7 |
# File 'lib/api_sketch/dsl/headers.rb', line 3 def initialize(&block) @list = [] define_singleton_method(:initialize_headers_list, block) initialize_headers_list end |
Instance Method Details
#add(name, &block) ⇒ Object
13 14 15 |
# File 'lib/api_sketch/dsl/headers.rb', line 13 def add(name, &block) @list << ::ApiSketch::Model::Header.new(::ApiSketch::DSL::AttributeParser.new(:document, &block).to_h.merge(name: name)) end |
#to_a ⇒ Object
9 10 11 |
# File 'lib/api_sketch/dsl/headers.rb', line 9 def to_a @list end |