Class: Interscript::Node::Item::CaptureGroup
- Inherits:
-
Interscript::Node::Item
- Object
- Interscript::Node
- Interscript::Node::Item
- Interscript::Node::Item::CaptureGroup
- Defined in:
- lib/interscript/node/item/capture.rb,
lib/interscript/visualize/nodes.rb
Overview
(…)
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Attributes inherited from Interscript::Node::Item
Instance Method Summary collapse
- #==(other) ⇒ Object
- #downcase ⇒ Object
- #first_string ⇒ Object
-
#initialize(data) ⇒ CaptureGroup
constructor
A new instance of CaptureGroup.
- #inspect ⇒ Object
- #nth_string ⇒ Object
- #to_hash ⇒ Object
- #to_html(doc) ⇒ Object
- #upcase ⇒ Object
Methods inherited from Interscript::Node::Item
Constructor Details
#initialize(data) ⇒ CaptureGroup
Returns a new instance of CaptureGroup.
5 6 7 8 |
# File 'lib/interscript/node/item/capture.rb', line 5 def initialize(data) data = Interscript::Node::Item.try_convert(data) @data = data end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/interscript/node/item/capture.rb', line 3 def data @data end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/interscript/node/item/capture.rb', line 26 def ==(other) super && self.data == other.data end |
#downcase ⇒ Object
18 |
# File 'lib/interscript/node/item/capture.rb', line 18 def downcase; self.dup.tap { |i| i.data = i.data.downcase }; end |
#first_string ⇒ Object
10 11 12 |
# File 'lib/interscript/node/item/capture.rb', line 10 def first_string data.first_string end |
#inspect ⇒ Object
30 31 32 |
# File 'lib/interscript/node/item/capture.rb', line 30 def inspect "capture(#{@data.inspect})" end |
#nth_string ⇒ Object
14 15 16 |
# File 'lib/interscript/node/item/capture.rb', line 14 def nth_string data.nth_string end |
#to_hash ⇒ Object
21 22 23 24 |
# File 'lib/interscript/node/item/capture.rb', line 21 def to_hash { :class => self.class.to_s, :data => self.data.to_hash } end |
#to_html(doc) ⇒ Object
42 43 44 45 46 |
# File 'lib/interscript/visualize/nodes.rb', line 42 def to_html(doc) "<nobr>capture group (</nobr>" + data.to_html(doc) + ")" end |
#upcase ⇒ Object
19 |
# File 'lib/interscript/node/item/capture.rb', line 19 def upcase; self.dup.tap { |i| i.data = i.data.upcase }; end |