Class: Diakonos::Range
Instance Attribute Summary collapse
-
#end_col ⇒ Object
Returns the value of attribute end_col.
-
#end_row ⇒ Object
Returns the value of attribute end_row.
-
#start_col ⇒ Object
readonly
Returns the value of attribute start_col.
-
#start_row ⇒ Object
readonly
Returns the value of attribute start_row.
Instance Method Summary collapse
- #contains?(row, col) ⇒ Boolean
-
#initialize(start_row, start_col, end_row, end_col) ⇒ Range
constructor
A new instance of Range.
Constructor Details
#initialize(start_row, start_col, end_row, end_col) ⇒ Range
Returns a new instance of Range.
6 7 8 |
# File 'lib/diakonos/range.rb', line 6 def initialize( start_row, start_col, end_row, end_col ) @start_row, @start_col, @end_row, @end_col = start_row, start_col, end_row, end_col end |
Instance Attribute Details
#end_col ⇒ Object
Returns the value of attribute end_col.
3 4 5 |
# File 'lib/diakonos/range.rb', line 3 def end_col @end_col end |
#end_row ⇒ Object
Returns the value of attribute end_row.
3 4 5 |
# File 'lib/diakonos/range.rb', line 3 def end_row @end_row end |
#start_col ⇒ Object (readonly)
Returns the value of attribute start_col.
3 4 5 |
# File 'lib/diakonos/range.rb', line 3 def start_col @start_col end |
#start_row ⇒ Object (readonly)
Returns the value of attribute start_row.
3 4 5 |
# File 'lib/diakonos/range.rb', line 3 def start_row @start_row end |
Instance Method Details
#contains?(row, col) ⇒ Boolean
10 11 12 13 14 15 16 17 18 |
# File 'lib/diakonos/range.rb', line 10 def contains?(row, col) if row == @start_row @start_col <= col elsif row == @end_row col < @end_col else @start_row < row && row < @end_row end end |