Class: Tag
- Inherits:
-
Object
- Object
- Tag
- Defined in:
- lib/smart_diff/htmlize.rb
Overview
A Tag wrapping an element in an HTML file. It contains information about the node wrapped inside it such as the start and end offset. The ‘tag` attr contains the actual HTML, and includes information used to style the nodes based on whether its an insertion, deletion or modification. Matching modifications are wrapped in anchor tags so they can be linked to their matches.
Instance Attribute Summary collapse
-
#idx ⇒ Object
Returns the value of attribute idx.
-
#start ⇒ Object
Returns the value of attribute start.
-
#tag ⇒ Object
Returns the value of attribute tag.
Instance Method Summary collapse
-
#initialize(tag, idx, start = -1)) ⇒ Tag
constructor
Construct a new tag.
-
#to_s ⇒ String
String representation of the Tag object.
Constructor Details
#initialize(tag, idx, start = -1)) ⇒ Tag
Construct a new tag.
27 28 29 30 31 |
# File 'lib/smart_diff/htmlize.rb', line 27 def initialize(tag, idx, start=-1) @tag = tag @idx = idx @start = start end |
Instance Attribute Details
#idx ⇒ Object
Returns the value of attribute idx.
16 17 18 |
# File 'lib/smart_diff/htmlize.rb', line 16 def idx @idx end |
#start ⇒ Object
Returns the value of attribute start.
16 17 18 |
# File 'lib/smart_diff/htmlize.rb', line 16 def start @start end |
#tag ⇒ Object
Returns the value of attribute tag.
16 17 18 |
# File 'lib/smart_diff/htmlize.rb', line 16 def tag @tag end |
Instance Method Details
#to_s ⇒ String
String representation of the Tag object.
38 39 40 |
# File 'lib/smart_diff/htmlize.rb', line 38 def to_s "tag: #{@tag}, idx: #{@idx} start: #{@start}" end |