Class: Flydata::Mysql::BinLogPosition

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/flydata/mysql/binlog_position.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fileObject

Returns the value of attribute file.


5
6
7
# File 'lib/flydata/mysql/binlog_position.rb', line 5

def file
  @file
end

#posObject

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_sObject


17
18
19
# File 'lib/flydata/mysql/binlog_position.rb', line 17

def to_s
  "#{file}\t#{pos}"
end