class Ox::Builder::Factory

Attributes

node[R]

Public Class Methods

new(node) click to toggle source
# File lib/ox/builder/factory.rb, line 8
def initialize(node)
  @node = node
end

Public Instance Methods

add_attributes(attributes) click to toggle source
# File lib/ox/builder/factory.rb, line 23
def add_attributes(attributes)
  attributes.each do |key, val|
    node[key] = val
  end
end
inspect() click to toggle source
# File lib/ox/builder/factory.rb, line 19
def inspect
  "#<#{self.class.name}:0x#{"%x" % object_id} node=#{node}>"
end
to_s(options = {}) click to toggle source
# File lib/ox/builder/factory.rb, line 12
def to_s(options = {})
  encoding = options.fetch(:encoding, 'UTF-8')
  indent = options.fetch(:indent, 2)
  Ox.dump(node, encoding: encoding, indent: indent)
end
Also aliased as: to_xml
to_xml(options = {})
Alias for: to_s

Protected Instance Methods

method_missing(name, *args, &block) click to toggle source
# File lib/ox/builder/factory.rb, line 31
def method_missing(name, *args, &block)
  name = name[0...-1] if name.to_s.end_with?('!')
  tag!(name, *args, &block)
end
with_dsl(obj, &block) click to toggle source
# File lib/ox/builder/factory.rb, line 36
def with_dsl(obj, &block)
  Factory.new(obj).tap(&block)
end