Class: Snuffle::LineOfCode
- Inherits:
-
Object
- Object
- Snuffle::LineOfCode
- Includes:
- Ephemeral::Base, PoroPlus
- Defined in:
- lib/snuffle/line_of_code.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#line_number ⇒ Object
Returns the value of attribute line_number.
-
#range ⇒ Object
Returns the value of attribute range.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
8 9 10 |
# File 'lib/snuffle/line_of_code.rb', line 8 def content @content end |
#line_number ⇒ Object
Returns the value of attribute line_number.
8 9 10 |
# File 'lib/snuffle/line_of_code.rb', line 8 def line_number @line_number end |
#range ⇒ Object
Returns the value of attribute range.
8 9 10 |
# File 'lib/snuffle/line_of_code.rb', line 8 def range @range end |
Class Method Details
.containing(locs, start_index, end_index) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/snuffle/line_of_code.rb', line 10 def self.containing(locs, start_index, end_index) locs.inject([]) do |a, loc| a << loc if loc.in_range?(start_index) || loc.in_range?(end_index) a end.compact end |
Instance Method Details
#in_range?(index) ⇒ Boolean
17 18 19 |
# File 'lib/snuffle/line_of_code.rb', line 17 def in_range?(index) self.range.include?(index) end |