Class: XAIML::Element::Base
- Defined in:
- lib/xaiml/element/base.rb
Direct Known Subclasses
Arg, Bot, BotId, Calc, Category, Command, Condition, ConditionalRandom, Ext, Get, Li, Log, Loop, Map, Matcher, Name, Pattern, Predstore, Random, Set, Sr, Srai, Sraix, SraixTopic, Star, Template, That, Think, Topic, Ub, Ut, Utterance, Value
Instance Attribute Summary collapse
-
#element ⇒ Object
Returns the value of attribute element.
Attributes inherited from Document
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}, object = nil) ⇒ Base
constructor
rubocop:disable Lint/MissingSuper -- intentionally skips Document#initialize; elements build a standalone fragment, not a full @document tree.
-
#write ⇒ Object
rubocop:enable Lint/MissingSuper.
Methods inherited from Document
#allowed_object?, #append_child, #append_into, load_file, #prepend_child
Constructor Details
#initialize(attributes = {}, object = nil) ⇒ Base
rubocop:disable Lint/MissingSuper -- intentionally skips Document#initialize; elements build a standalone fragment, not a full @document tree
12 13 14 15 16 17 18 |
# File 'lib/xaiml/element/base.rb', line 12 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
#element ⇒ Object
Returns the value of attribute element.
6 7 8 |
# File 'lib/xaiml/element/base.rb', line 6 def element @element end |
Class Method Details
.allowed_object ⇒ Object
8 9 |
# File 'lib/xaiml/element/base.rb', line 8 def self.allowed_object end |
Instance Method Details
#write ⇒ Object
rubocop:enable Lint/MissingSuper
21 22 23 |
# File 'lib/xaiml/element/base.rb', line 21 def write Ox.dump(@element) end |