Class: XAIML::Element::Base

Inherits:
Document show all
Defined in:
lib/xaiml/element/base.rb

Instance Attribute Summary collapse

Attributes inherited from Document

#document

Instance Method Summary collapse

Methods inherited from Document

#allowed_object?, #append_child, #append_into, load_file, #prepend_child

Constructor Details

#initialize(attributes = {}, object = nil) ⇒ Base

Returns a new instance of Base.



6
7
8
9
10
11
12
# File 'lib/xaiml/element/base.rb', line 6

def initialize(attributes = {}, object = nil)
  @element = Ox::Element.new(self.class.name.split("::").last.downcase)
  attributes.each do |k, v|
    @element[k] = v
  end
  append_child(object) if object
end

Instance Attribute Details

#elementObject

Returns the value of attribute element.



4
5
6
# File 'lib/xaiml/element/base.rb', line 4

def element
  @element
end

Instance Method Details

#writeObject



14
15
16
# File 'lib/xaiml/element/base.rb', line 14

def write
  Ox.dump(@element)
end