Class: MML::Facility

Inherits:
Object
  • Object
show all
Defined in:
lib/mml/common.rb

Direct Known Subclasses

Department

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Facility

Returns a new instance of Facility.



178
179
180
181
182
# File 'lib/mml/common.rb', line 178

def initialize(args = {})
  %W(name id).each do |item|
    self.send("#{item}=", args[item.to_sym])
  end
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



176
177
178
# File 'lib/mml/common.rb', line 176

def id
  @id
end

#nameObject

Returns the value of attribute name.



175
176
177
# File 'lib/mml/common.rb', line 175

def name
  @name
end

Instance Method Details

#to_xmlObject



189
190
191
192
193
194
195
196
197
198
199
# File 'lib/mml/common.rb', line 189

def to_xml
  xb = Builder::XmlMarkup.new
  xb.mmlFc :Facility do
    name.each do |n|
      attributes = {'mmlFc:repCode' => n.repCode}
      attributes['mmlFc:tableId'] = n.tableId if n.tableId
      xb.mmlFc :name, n.value, attributes
    end
    xb << id.to_xml if id
  end
end