Class: Kwartz::TagInfo
- Inherits:
-
Object
- Object
- Kwartz::TagInfo
- Defined in:
- lib/kwartz/converter.rb
Instance Attribute Summary collapse
-
#attr_str ⇒ Object
Returns the value of attribute attr_str.
-
#extra_space ⇒ Object
Returns the value of attribute extra_space.
-
#head_space ⇒ Object
Returns the value of attribute head_space.
-
#is_empty ⇒ Object
(also: #is_empty?)
Returns the value of attribute is_empty.
-
#is_etag ⇒ Object
(also: #is_etag?)
Returns the value of attribute is_etag.
-
#linenum ⇒ Object
Returns the value of attribute linenum.
-
#prev_text ⇒ Object
Returns the value of attribute prev_text.
-
#tag_text ⇒ Object
Returns the value of attribute tag_text.
-
#tagname ⇒ Object
Returns the value of attribute tagname.
-
#tail_space ⇒ Object
Returns the value of attribute tail_space.
Instance Method Summary collapse
- #_inspect ⇒ Object
-
#clear_as_dummy_tag ⇒ Object
delete <span> tag.
-
#initialize(matched, linenum = nil) ⇒ TagInfo
constructor
A new instance of TagInfo.
- #rebuild_tag_text(attr_info = nil) ⇒ Object
Constructor Details
#initialize(matched, linenum = nil) ⇒ TagInfo
Returns a new instance of TagInfo.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/kwartz/converter.rb', line 47 def initialize(matched, linenum=nil) @prev_text = matched[1] @tag_text = matched[2] @head_space = matched[3] @is_etag = matched[4] == '/' @tagname = matched[5] @attr_str = matched[6] @extra_space = matched[7] @is_empty = matched[8] == '/' @tail_space = matched[9] @linenum = linenum end |
Instance Attribute Details
#attr_str ⇒ Object
Returns the value of attribute attr_str.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def attr_str @attr_str end |
#extra_space ⇒ Object
Returns the value of attribute extra_space.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def extra_space @extra_space end |
#head_space ⇒ Object
Returns the value of attribute head_space.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def head_space @head_space end |
#is_empty ⇒ Object Also known as: is_empty?
Returns the value of attribute is_empty.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def is_empty @is_empty end |
#is_etag ⇒ Object Also known as: is_etag?
Returns the value of attribute is_etag.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def is_etag @is_etag end |
#linenum ⇒ Object
Returns the value of attribute linenum.
62 63 64 |
# File 'lib/kwartz/converter.rb', line 62 def linenum @linenum end |
#prev_text ⇒ Object
Returns the value of attribute prev_text.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def prev_text @prev_text end |
#tag_text ⇒ Object
Returns the value of attribute tag_text.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def tag_text @tag_text end |
#tagname ⇒ Object
Returns the value of attribute tagname.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def tagname @tagname end |
#tail_space ⇒ Object
Returns the value of attribute tail_space.
61 62 63 |
# File 'lib/kwartz/converter.rb', line 61 def tail_space @tail_space end |
Instance Method Details
#_inspect ⇒ Object
92 93 94 |
# File 'lib/kwartz/converter.rb', line 92 def _inspect return [ @prev_text, @head_space, @is_etag, @tagname, @attr_str, @extra_space, @is_empty, @tail_space ] end |
#clear_as_dummy_tag ⇒ Object
delete <span> tag
86 87 88 89 |
# File 'lib/kwartz/converter.rb', line 86 def clear_as_dummy_tag # delete <span> tag @tagname = nil @head_space = @tail_space = nil if @head_space && @tail_space end |
#rebuild_tag_text(attr_info = nil) ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/kwartz/converter.rb', line 74 def rebuild_tag_text(attr_info=nil) if attr_info sb = '' attr_info.each do |space, aname, avalue| sb << "#{space}#{aname}=\"#{avalue}\"" end @attr_str = sb end @tag_text = "#{@head_space}<#{@is_etag ? '/' : ''}#{@tagname}#{@attr_str}#{@extra_space}#{@is_empty ? '/' : ''}>#{@tail_space}" end |