Class: Sem4r::GeoLocationSelector

Inherits:
Object
  • Object
show all
Includes:
Sem4rSoap::SoapAttributes
Defined in:
lib/sem4r/geo_location/geo_location_selector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sem4rSoap::SoapAttributes

#_from_element, #_to_s, #_to_xml, included

Constructor Details

#initialize(&block) ⇒ GeoLocationSelector

Returns a new instance of GeoLocationSelector.



32
33
34
35
36
37
# File 'lib/sem4r/geo_location/geo_location_selector.rb', line 32

def initialize(&block)
  @addresses = []
  if block_given?
    block.arity < 1 ? instance_eval(&block) : block.call(self)
  end
end

Instance Attribute Details

#addressesObject (readonly)

Returns the value of attribute addresses.



30
31
32
# File 'lib/sem4r/geo_location/geo_location_selector.rb', line 30

def addresses
  @addresses
end

Instance Method Details

#address(address = nil, &block) ⇒ Object



39
40
41
42
43
44
45
# File 'lib/sem4r/geo_location/geo_location_selector.rb', line 39

def address(address = nil, &block)
  if address.nil? and block_given?
    @addresses << Address.new(&block)
  else
    @addresses << address
  end
end

#to_xmlObject



47
48
49
50
51
52
53
54
# File 'lib/sem4r/geo_location/geo_location_selector.rb', line 47

def to_xml
  xml = "<s:selector>"
  @addresses.each do |address|
    xml += address.to_xml("addresses")
  end
  xml += "</s:selector>"
  xml
end