Class: HTree::ETag

Inherits:
Object
  • Object
show all
Includes:
Tag
Defined in:
lib/htree/tag.rb,
lib/htree/inspect.rb,
lib/htree/modules.rb,
lib/htree/equality.rb,
lib/htree/raw_string.rb

Constant Summary

Constants included from HTree

DefaultContext, ElementContent, ElementExclusions, ElementInclusions, EmptyBindingObject, HTMLContext, NamedCharacters, NamedCharactersPattern, OmittedAttrName

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Tag

#init_raw_string, #raw_string=, #raw_string_internal

Methods included from HTree

#==, build_node, #check_equality, compile_template, #exact_equal?, #exact_equal_object, expand_template, fix_element, fix_structure_list, frozen_string, #hash, #make_usual_equal_object, parse_as, parse_pairs, parse_xml, scan, with_frozen_string_hash

Constructor Details

#initialize(qualified_name) ⇒ ETag

Returns a new instance of ETag.



105
106
107
108
# File 'lib/htree/tag.rb', line 105

def initialize(qualified_name)
  init_raw_string
  @qualified_name = HTree.frozen_string(qualified_name)
end

Instance Attribute Details

#qualified_nameObject (readonly) Also known as: usual_equal_object

Returns the value of attribute qualified_name.



109
110
111
# File 'lib/htree/tag.rb', line 109

def qualified_name
  @qualified_name
end

Class Method Details

.parse(raw_string, is_xml, is_html) ⇒ Object



279
280
281
282
283
284
285
286
287
288
289
290
# File 'lib/htree/parse.rb', line 279

def ETag.parse(raw_string, is_xml, is_html)
  unless /\A#{Pat::EndTag_C}\z/o =~ raw_string
    raise HTree::Error, "cannot recognize as end tag: #{raw_string.inspect}"
  end

  qname = $1
  qname = qname.downcase if !is_xml && is_html

  result = self.new(qname)
  result.raw_string = raw_string
  result
end

Instance Method Details

#eliminate_raw_stringObject



98
99
100
# File 'lib/htree/raw_string.rb', line 98

def eliminate_raw_string
  self.class.new(@qualified_name)
end

#make_exact_equal_objectObject



147
148
149
# File 'lib/htree/equality.rb', line 147

def make_exact_equal_object
  [@raw_string, @qualified_name]
end

#pretty_print(q) ⇒ Object



86
87
88
89
90
# File 'lib/htree/inspect.rb', line 86

def pretty_print(q)
  q.group(1, '</', '>') {
    q.text @qualified_name
  }
end