Class: ActiveRecord::ConnectionAdapters::MasterSlaveAdapter::Clock
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::MasterSlaveAdapter::Clock
- Includes:
- Comparable
- Defined in:
- lib/master_slave_adapter/adapter.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(file, position) ⇒ Clock
constructor
A new instance of Clock.
- #to_s ⇒ Object
Constructor Details
#initialize(file, position) ⇒ Clock
Returns a new instance of Clock.
8 9 10 11 |
# File 'lib/master_slave_adapter/adapter.rb', line 8 def initialize(file, position) raise ArgumentError, "file and postion may not be nil" if file.nil? || position.nil? @file, @position = file, position.to_i end |
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/master_slave_adapter/adapter.rb', line 7 def file @file end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
7 8 9 |
# File 'lib/master_slave_adapter/adapter.rb', line 7 def position @position end |
Class Method Details
Instance Method Details
#<=>(other) ⇒ Object
12 13 14 |
# File 'lib/master_slave_adapter/adapter.rb', line 12 def <=>(other) @file == other.file ? @position <=> other.position : @file <=> other.file end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/master_slave_adapter/adapter.rb', line 15 def to_s "#{@file}@#{@position}" end |