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



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

def elem
  @elem
end

#end_lineObject

Returns the value of attribute end_line

Returns:

  • (Object)

    the current value of end_line



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

def end_line
  @end_line
end

#start_lineObject

Returns the value of attribute start_line

Returns:

  • (Object)

    the current value of start_line



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

def start_line
  @start_line
end

Instance Method Details

#contains?(line_num) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'lib/canon/xml/line_range_mapper.rb', line 42

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

#lengthObject



46
47
48
# File 'lib/canon/xml/line_range_mapper.rb', line 46

def length
  end_line - start_line + 1
end