Class: Versioner::YamlBackend
- Inherits:
-
Object
- Object
- Versioner::YamlBackend
- Defined in:
- lib/versioner/versioner_yaml.rb
Instance Method Summary collapse
- #force(major, minor, patch) ⇒ Object
- #increment_major ⇒ Object
- #increment_minor ⇒ Object
- #increment_patch ⇒ Object
-
#initialize(path) ⇒ YamlBackend
constructor
A new instance of YamlBackend.
- #major ⇒ Object
- #minor ⇒ Object
- #patch ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(path) ⇒ YamlBackend
Returns a new instance of YamlBackend.
5 6 7 8 |
# File 'lib/versioner/versioner_yaml.rb', line 5 def initialize(path) self.path = path read end |
Instance Method Details
#force(major, minor, patch) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/versioner/versioner_yaml.rb', line 26 def force(major, minor, patch) self.major = major self.minor = minor self.patch = patch write version end |
#increment_major ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/versioner/versioner_yaml.rb', line 34 def increment_major self.major = major + 1 self.minor = 0 self.patch = 0 write version end |
#increment_minor ⇒ Object
42 43 44 45 46 47 |
# File 'lib/versioner/versioner_yaml.rb', line 42 def increment_minor self.minor = minor + 1 self.patch = 0 write version end |
#increment_patch ⇒ Object
49 50 51 52 53 |
# File 'lib/versioner/versioner_yaml.rb', line 49 def increment_patch self.patch = patch + 1 write version end |
#major ⇒ Object
14 15 16 |
# File 'lib/versioner/versioner_yaml.rb', line 14 def major data[:major] end |
#minor ⇒ Object
18 19 20 |
# File 'lib/versioner/versioner_yaml.rb', line 18 def minor data[:minor] end |
#patch ⇒ Object
22 23 24 |
# File 'lib/versioner/versioner_yaml.rb', line 22 def patch data[:patch] end |
#version ⇒ Object
10 11 12 |
# File 'lib/versioner/versioner_yaml.rb', line 10 def version "#{major}.#{minor}.#{patch}" end |