Class: Parkeon::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/parkeon/builder.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method_name) ⇒ Builder

Returns a new instance of Builder.



8
9
10
# File 'lib/parkeon/builder.rb', line 8

def initialize(method_name)
  @method_name = method_name
end

Class Method Details

.build(method_name, &block) ⇒ Object



4
5
6
# File 'lib/parkeon/builder.rb', line 4

def self.build(method_name, &block)
  new(method_name).build(&block)
end

Instance Method Details

#build(&block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/parkeon/builder.rb', line 12

def build(&block)
  Nokogiri::XML::Builder.new do |xml|
    xml.methodCall {
      xml.methodName method_name 
      xml.params {
        xml.param {
          xml.value {
            xml.struct {
              block.call(xml)              
            } 
          } 
        } 
      }
    } 
  end.to_xml
end