Class: Interscript::Node::Item::CaptureRef

Inherits:
Interscript::Node::Item show all
Defined in:
lib/interscript/node/item/capture.rb,
lib/interscript/visualize/nodes.rb

Overview

1

Instance Attribute Summary collapse

Attributes inherited from Interscript::Node::Item

#item

Instance Method Summary collapse

Methods inherited from Interscript::Node::Item

#+, try_convert

Constructor Details

#initialize(id) ⇒ CaptureRef

Returns a new instance of CaptureRef.



39
40
41
# File 'lib/interscript/node/item/capture.rb', line 39

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



37
38
39
# File 'lib/interscript/node/item/capture.rb', line 37

def id
  @id
end

Instance Method Details

#==(other) ⇒ Object



54
55
56
# File 'lib/interscript/node/item/capture.rb', line 54

def ==(other)
  super && self.id == other.id
end

#first_stringObject Also known as: nth_string



43
44
45
# File 'lib/interscript/node/item/capture.rb', line 43

def first_string
  self
end

#inspectObject



58
59
60
# File 'lib/interscript/node/item/capture.rb', line 58

def inspect
  "ref(#{@id.inspect})"
end

#to_hashObject



49
50
51
52
# File 'lib/interscript/node/item/capture.rb', line 49

def to_hash
  { :class => self.class.to_s,
    :id => self.id }
end

#to_html(_) ⇒ Object



50
51
52
53
54
# File 'lib/interscript/visualize/nodes.rb', line 50

def to_html(_)
  "<nobr>capture reference (</nobr>" +
    id.to_s +
  ")"
end