class HTree::Elem

Public Instance Methods

attributes_str() click to toggle source
# File vendor/qwik/lib/qwik/htree-get.rb, line 125
def attributes_str
  return hash_to_str(attributes)
end
clone_with(*ar) click to toggle source
# File vendor/qwik/lib/qwik/htree-template.rb, line 86
def clone_with(*ar)
  name = self.name
  org_attr = self.attributes
  attr = symbol_to_str(org_attr)

  nar = []
  ar.flatten.each {|e|
    if e.is_a?(Hash)
      data = symbol_to_str(e)
      attr.update(data)
    elsif e.nil?
      # do nothing
    else
      nar << e
    end
  }

  return Elem.new(name, attr, @children, *nar)
end
clone_without_child() click to toggle source
# File vendor/qwik/lib/qwik/htree-template.rb, line 79
def clone_without_child
  name = self.name
  org_attr = self.attributes
  attr = symbol_to_str(org_attr)
  return Elem.new(name, attr)
end
delete_spaces() click to toggle source
# File vendor/qwik/lib/qwik/htree-template.rb, line 72
def delete_spaces
  ar = map {|e|
    e.is_a?(HTree::Text) ? e.to_s.sub(/^\s+/, "").sub(/\s+$/, "") : e
  }
  clone_without_child.clone_with(ar)
end
hash_to_str(src) click to toggle source
# File vendor/qwik/lib/qwik/htree-get.rb, line 129
def hash_to_str(src)
  h = {}
  src.each {|k, v| h[k.to_s] = v.to_s }
  return h
end

Private Instance Methods

symbol_to_str(sdata) click to toggle source
# File vendor/qwik/lib/qwik/htree-template.rb, line 108
def symbol_to_str(sdata)
  data = {}
  sdata.each {|k, v|
    data[k.to_s] = v.to_s
  }
  return data
end