Class: Decode::Language::Ruby::Segment
- Defined in:
- lib/decode/language/ruby/segment.rb
Overview
A Ruby specific code segment.
Instance Attribute Summary collapse
-
#node ⇒ Object
readonly
The parser syntax tree node.
Attributes inherited from Segment
#The language of the code attached to this segment., #The preceeding comments., #comments, #language
Instance Method Summary collapse
-
#code ⇒ Object
The source code trailing the comments.
-
#expand(node) ⇒ Object
Expand the segment to include another node.
-
#initialize(comments, language, node, **options) ⇒ Segment
constructor
Initialize a new Ruby segment.
Methods inherited from Segment
Constructor Details
#initialize(comments, language, node, **options) ⇒ Segment
Initialize a new Ruby segment.
18 19 20 21 22 23 |
# File 'lib/decode/language/ruby/segment.rb', line 18 def initialize(comments, language, node, **) super(comments, language, **) @node = node @expression = node.location end |
Instance Attribute Details
#node ⇒ Object (readonly)
The parser syntax tree node.
26 27 28 |
# File 'lib/decode/language/ruby/segment.rb', line 26 def node @node end |
Instance Method Details
#code ⇒ Object
The source code trailing the comments.
36 37 38 |
# File 'lib/decode/language/ruby/segment.rb', line 36 def code @expression.slice end |
#expand(node) ⇒ Object
Expand the segment to include another node.
30 31 32 |
# File 'lib/decode/language/ruby/segment.rb', line 30 def (node) @expression = @expression.join(node.location) end |