class Remarkably::Engines::XML

Public Instance Methods

method!(sym, args, hash, &block) click to toggle source
# File lib/remarkably/engines/xml.rb, line 7
def method! sym, args, hash, &block
  sym = sym.to_s.downcase

  tag_attributes =
    hash.inject([]){|s,(k,v)| s << %{#{k.to_s.downcase}="#{v}"} }

  @output << ( ["<#{sym}"] +  tag_attributes).join(' ')

  if block_given? or not args.empty?
    @output << ">"
    block.call if block_given?
    @output << "#{args.join}</#{sym}>"
  else
    @output << "/>"
  end

  self
end
text(args, hash) click to toggle source
# File lib/remarkably/engines/xml.rb, line 26
def text args, hash
  @output << args.join
  self
end