Class: Standoff::Tag
- Inherits:
-
Object
- Object
- Standoff::Tag
- Defined in:
- lib/standoff.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#content ⇒ Object
Returns the value of attribute content.
-
#end ⇒ Object
Returns the value of attribute end.
-
#name ⇒ Object
Returns the value of attribute name.
-
#start ⇒ Object
Returns the value of attribute start.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(options = {}) ⇒ Tag
constructor
A new instance of Tag.
- #overlap(other_tag) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Tag
Returns a new instance of Tag.
120 121 122 123 124 125 126 |
# File 'lib/standoff.rb', line 120 def initialize( = {}) @name = [:name] # string @attributes = [:attributes] # hash @content = [:content] # string @start = [:start] # numeric @end = [:end] end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
119 120 121 |
# File 'lib/standoff.rb', line 119 def attributes @attributes end |
#content ⇒ Object
Returns the value of attribute content.
119 120 121 |
# File 'lib/standoff.rb', line 119 def content @content end |
#end ⇒ Object
Returns the value of attribute end.
119 120 121 |
# File 'lib/standoff.rb', line 119 def end @end end |
#name ⇒ Object
Returns the value of attribute name.
119 120 121 |
# File 'lib/standoff.rb', line 119 def name @name end |
#start ⇒ Object
Returns the value of attribute start.
119 120 121 |
# File 'lib/standoff.rb', line 119 def start @start end |
Instance Method Details
#<=>(other) ⇒ Object
127 128 129 |
# File 'lib/standoff.rb', line 127 def <=> (other) return @end <=> other.end end |
#overlap(other_tag) ⇒ Object
130 131 132 |
# File 'lib/standoff.rb', line 130 def overlap (other_tag) ! ((@start .. @end).to_a & (other_tag.start .. other_tag.end).to_a).empty? end |