Class: Prosereflect::NodeRange
- Inherits:
-
Object
- Object
- Prosereflect::NodeRange
- Defined in:
- lib/prosereflect/resolved_pos.rb
Overview
NodeRange represents a range between two resolved positions
Instance Attribute Summary collapse
-
#end_ ⇒ Object
(also: #end)
readonly
Returns the value of attribute end_.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
Instance Method Summary collapse
-
#content ⇒ Object
Content fragment between start and end.
-
#initialize(start_resolved, end_resolved) ⇒ NodeRange
constructor
A new instance of NodeRange.
- #inspect ⇒ Object
-
#nodes ⇒ Object
Nodes within this range.
- #to_s ⇒ Object
Constructor Details
#initialize(start_resolved, end_resolved) ⇒ NodeRange
Returns a new instance of NodeRange.
181 182 183 184 |
# File 'lib/prosereflect/resolved_pos.rb', line 181 def initialize(start_resolved, end_resolved) @start = start_resolved @end_ = end_resolved end |
Instance Attribute Details
#end_ ⇒ Object (readonly) Also known as: end
Returns the value of attribute end_.
177 178 179 |
# File 'lib/prosereflect/resolved_pos.rb', line 177 def end_ @end_ end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
177 178 179 |
# File 'lib/prosereflect/resolved_pos.rb', line 177 def start @start end |
Instance Method Details
#content ⇒ Object
Content fragment between start and end
187 188 189 190 |
# File 'lib/prosereflect/resolved_pos.rb', line 187 def content # Would extract the fragment Fragment.new([]) end |
#inspect ⇒ Object
203 204 205 |
# File 'lib/prosereflect/resolved_pos.rb', line 203 def inspect to_s end |
#nodes ⇒ Object
Nodes within this range
193 194 195 196 197 |
# File 'lib/prosereflect/resolved_pos.rb', line 193 def nodes result = [] start.node.nodes_between(start.pos, end_.pos) { |n| result << n } result end |
#to_s ⇒ Object
199 200 201 |
# File 'lib/prosereflect/resolved_pos.rb', line 199 def to_s "<NodeRange #{start.pos}:#{end_.pos}>" end |