Class: Reedb::Version_spec
- Inherits:
-
Object
- Object
- Reedb::Version_spec
- Defined in:
- lib/reedb/utils/version.rb
Overview
Has been depreciated in version 0.9.9 (of Reedb, not the class) Too specific and broad usecase. Was replaced with the new Version DO NOT USE!
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#numeral ⇒ Object
readonly
Returns the value of attribute numeral.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(existing = nil) ⇒ Version_spec
constructor
A new instance of Version_spec.
-
#to_s ⇒ Object
def greater(other) if @timestamp > other.timestamp puts “This is greater” else puts “Other is greater” end end.
- #update ⇒ Object
Constructor Details
#initialize(existing = nil) ⇒ Version_spec
Returns a new instance of Version_spec.
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/reedb/utils/version.rb', line 51 def initialize(existing = nil) puts "DO NOT USE! Use 'Reedb::Version' INSTEAD!" if existing data = existing.split('_') @host = data[0] # Hack to make the version numeral work. @numeral = data[1].split('.') @numeral[0] = @numeral[0].to_i @numeral[1] = @numeral[1].to_i @timestamp = data[2] @timestamp = @timestamp.to_i return self end @host = Reedb::Utilities::parse_host @timestamp = DateTime.now.strftime('%Q') @numeral = [0, 0] @timestamp = @timestamp.to_i end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
49 50 51 |
# File 'lib/reedb/utils/version.rb', line 49 def host @host end |
#numeral ⇒ Object (readonly)
Returns the value of attribute numeral.
49 50 51 |
# File 'lib/reedb/utils/version.rb', line 49 def numeral @numeral end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
49 50 51 |
# File 'lib/reedb/utils/version.rb', line 49 def @timestamp end |
Instance Method Details
#to_s ⇒ Object
def greater(other) if @timestamp > other.timestamp puts “This is greater” else puts “Other is greater” end end
86 87 88 |
# File 'lib/reedb/utils/version.rb', line 86 def to_s return [@host, @numeral.join('.'), @timestamp].join('_') end |
#update ⇒ Object
72 73 74 75 76 |
# File 'lib/reedb/utils/version.rb', line 72 def update @timestamp = DateTime.now.strftime('%Q') @host == Reedb::Utilities::parse_host ? incr_last : incr_first @host = Reedb::Utilities::parse_host end |