Class: WSDSL::Response
- Inherits:
-
Object
- Object
- WSDSL::Response
- Defined in:
- lib/response.rb
Overview
Response DSL class
Defined Under Namespace
Classes: Element
Instance Attribute Summary collapse
-
#elements ⇒ Array<WSDSL::Response::Element>
readonly
The list of all the elements inside the response.
Instance Method Summary collapse
-
#element(opts = {}) {|WSDSL::Response::Element| ... } ⇒ Array<WSDSL::Response::Element>
Defines a new element and yields the content of an optional block Each new element is then stored in the elements array.
-
#element_named(name) ⇒ WSDSL::Response::Element
Returns a response element object based on its name.
-
#initialize ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
12 13 14 |
# File 'lib/response.rb', line 12 def initialize @elements = [] end |
Instance Attribute Details
#elements ⇒ Array<WSDSL::Response::Element> (readonly)
The list of all the elements inside the response
10 11 12 |
# File 'lib/response.rb', line 10 def elements @elements end |
Instance Method Details
#element(opts = {}) {|WSDSL::Response::Element| ... } ⇒ Array<WSDSL::Response::Element>
Defines a new element and yields the content of an optional block Each new element is then stored in the elements array.
31 32 33 34 35 |
# File 'lib/response.rb', line 31 def element(opts={}) el = Element.new(opts) yield(el) if block_given? @elements << el end |
#element_named(name) ⇒ WSDSL::Response::Element
Returns a response element object based on its name
42 43 44 |
# File 'lib/response.rb', line 42 def element_named(name) @elements.find{|e| e.name.to_s == name.to_s} end |