Class: Flydata::Mysql::BinLogPosition
- Inherits:
-
Object
- Object
- Flydata::Mysql::BinLogPosition
- Includes:
- Comparable
- Defined in:
- lib/flydata/mysql/binlog_position.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#pos ⇒ Object
Returns the value of attribute pos.
Instance Method Summary collapse
- #<=>(obj) ⇒ Object
-
#initialize(binlog_content) ⇒ BinLogPosition
constructor
A new instance of BinLogPosition.
- #to_s ⇒ Object
Constructor Details
#initialize(binlog_content) ⇒ BinLogPosition
Returns a new instance of BinLogPosition.
7 8 9 10 11 |
# File 'lib/flydata/mysql/binlog_position.rb', line 7 def initialize(binlog_content) items = binlog_content.split("\t") @file = items[0] @pos = items[1].to_i end |
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file.
5 6 7 |
# File 'lib/flydata/mysql/binlog_position.rb', line 5 def file @file end |
#pos ⇒ Object
Returns the value of attribute pos.
5 6 7 |
# File 'lib/flydata/mysql/binlog_position.rb', line 5 def pos @pos end |
Instance Method Details
#<=>(obj) ⇒ Object
13 14 15 |
# File 'lib/flydata/mysql/binlog_position.rb', line 13 def <=>(obj) (self.file <=> obj.file) == 0 ? (self.pos <=> obj.pos) : (self.file <=> obj.file) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/flydata/mysql/binlog_position.rb', line 17 def to_s "#{file}\t#{pos}" end |