Class: Diakonos::Bookmark
Instance Attribute Summary collapse
-
#buffer ⇒ Object
readonly
Returns the value of attribute buffer.
-
#col ⇒ Object
readonly
Returns the value of attribute col.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#row ⇒ Object
readonly
Returns the value of attribute row.
Instance Method Summary collapse
- #<(other) ⇒ Object
- #<=>(other) ⇒ Object
- #==(other) ⇒ Object
- #>(other) ⇒ Object
-
#initialize(buffer, row, col, name = nil) ⇒ Bookmark
constructor
A new instance of Bookmark.
- #shift(row_inc, col_inc) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(buffer, row, col, name = nil) ⇒ Bookmark
Returns a new instance of Bookmark.
7 8 9 10 11 12 |
# File 'lib/diakonos/bookmark.rb', line 7 def initialize( buffer, row, col, name = nil ) @buffer = buffer @row = row @col = col @name = name end |
Instance Attribute Details
#buffer ⇒ Object (readonly)
Returns the value of attribute buffer.
5 6 7 |
# File 'lib/diakonos/bookmark.rb', line 5 def buffer @buffer end |
#col ⇒ Object (readonly)
Returns the value of attribute col.
5 6 7 |
# File 'lib/diakonos/bookmark.rb', line 5 def col @col end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/diakonos/bookmark.rb', line 5 def name @name end |
#row ⇒ Object (readonly)
Returns the value of attribute row.
5 6 7 |
# File 'lib/diakonos/bookmark.rb', line 5 def row @row end |
Instance Method Details
#<(other) ⇒ Object
28 29 30 |
# File 'lib/diakonos/bookmark.rb', line 28 def < (other) ( ( self <=> other ) < 0 ) end |
#<=>(other) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/diakonos/bookmark.rb', line 19 def <=> (other) return nil if other.nil? comparison = ( $diakonos.buffer_to_number( @buffer ) <=> $diakonos.buffer_to_number( other.buffer ) ) return comparison if comparison != 0 comparison = ( @row <=> other.row ) return comparison if comparison != 0 @col <=> other.col end |
#==(other) ⇒ Object
14 15 16 17 |
# File 'lib/diakonos/bookmark.rb', line 14 def == (other) return false if other.nil? ( @buffer == other.buffer && @row == other.row && @col == other.col ) end |
#>(other) ⇒ Object
31 32 33 |
# File 'lib/diakonos/bookmark.rb', line 31 def > (other) ( ( self <=> other ) > 0 ) end |
#shift(row_inc, col_inc) ⇒ Object
35 36 37 38 |
# File 'lib/diakonos/bookmark.rb', line 35 def shift( row_inc, col_inc ) row += row_inc col += col_inc end |
#to_s ⇒ Object
40 41 42 |
# File 'lib/diakonos/bookmark.rb', line 40 def to_s "[#{@name}|#{@buffer.name}:#{@row+1},#{@col+1}]" end |