Class: Reedb::Version1
- Inherits:
-
Object
- Object
- Reedb::Version1
- Defined in:
- lib/reedb/utils/version.rb
Instance Attribute Summary collapse
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Instance Method Summary collapse
-
#initialize(existing = nil) ⇒ Version1
constructor
A new instance of Version1.
-
#to_s ⇒ Object
This formatting is actually used in the dataset.
- #update ⇒ Object
Constructor Details
#initialize(existing = nil) ⇒ Version1
Returns a new instance of Version1.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/reedb/utils/version.rb', line 16 def initialize(existing = nil) # If a version is created from an existing pattern if existing != nil existing["R"] = "" if existing[0] == "R" data = existing.split('::') @revision = data[0].to_i = data[1].to_i return self end # This creates a new version @revision = 1 = DateTime.now.strftime('%Q') end |
Instance Attribute Details
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
14 15 16 |
# File 'lib/reedb/utils/version.rb', line 14 def revision @revision end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
14 15 16 |
# File 'lib/reedb/utils/version.rb', line 14 def end |
Instance Method Details
#to_s ⇒ Object
This formatting is actually used in the dataset
38 39 40 |
# File 'lib/reedb/utils/version.rb', line 38 def to_s return "R#{@revision}::#{@timestamp}" end |
#update ⇒ Object
32 33 34 35 |
# File 'lib/reedb/utils/version.rb', line 32 def update @revision += 1 = DateTime.now.strftime('%Q') end |