Class: Canon::Xml::LineRangeMapper::LineRange

Inherits:
Struct
  • Object
show all
Defined in:
lib/canon/xml/line_range_mapper.rb

Overview

Line range for an element

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#elemObject

Returns the value of attribute elem

Returns:

  • (Object)

    the current value of elem



39
40
41
# File 'lib/canon/xml/line_range_mapper.rb', line 39

def elem
  @elem
end

#end_lineObject

Returns the value of attribute end_line

Returns:

  • (Object)

    the current value of end_line



39
40
41
# File 'lib/canon/xml/line_range_mapper.rb', line 39

def end_line
  @end_line
end

#start_lineObject

Returns the value of attribute start_line

Returns:

  • (Object)

    the current value of start_line



39
40
41
# File 'lib/canon/xml/line_range_mapper.rb', line 39

def start_line
  @start_line
end

Instance Method Details

#contains?(line_num) ⇒ Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/canon/xml/line_range_mapper.rb', line 40

def contains?(line_num)
  line_num.between?(start_line, end_line)
end

#lengthObject



44
45
46
# File 'lib/canon/xml/line_range_mapper.rb', line 44

def length
  end_line - start_line + 1
end