Class: ActiveRecord::ConnectionAdapters::MasterSlaveAdapter::Clock
- Inherits:
-
Object
- Object
- ActiveRecord::ConnectionAdapters::MasterSlaveAdapter::Clock
- Includes:
- Comparable
- Defined in:
- lib/master_slave_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.
99 100 101 102 |
# File 'lib/master_slave_adapter.rb', line 99 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.
97 98 99 |
# File 'lib/master_slave_adapter.rb', line 97 def file @file end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
97 98 99 |
# File 'lib/master_slave_adapter.rb', line 97 def position @position end |
Class Method Details
Instance Method Details
#<=>(other) ⇒ Object
104 105 106 |
# File 'lib/master_slave_adapter.rb', line 104 def <=>(other) @file == other.file ? @position <=> other.position : @file <=> other.file end |
#to_s ⇒ Object
108 109 110 |
# File 'lib/master_slave_adapter.rb', line 108 def to_s [ @file, @position ].join('@') end |