Class: RakeTasks::Gem::Version
- Inherits:
-
Object
- Object
- RakeTasks::Gem::Version
- Defined in:
- lib/rake_tasks/gem.rb
Instance Method Summary collapse
-
#initialize(string_version) ⇒ Version
constructor
A new instance of Version.
- #next_major_version! ⇒ Object
- #next_minor_version! ⇒ Object
- #next_revision! ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(string_version) ⇒ Version
Returns a new instance of Version.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rake_tasks/gem.rb', line 40 def initialize(string_version) @marks = string_version.split('.') @marks = @marks.map do |mark| if mark.to_i.to_s == mark.to_s mark.to_i else mark end end end |
Instance Method Details
#next_major_version! ⇒ Object
70 71 72 73 74 75 76 77 78 79 |
# File 'lib/rake_tasks/gem.rb', line 70 def next_major_version! @marks = @marks.select { |m| m.class == Fixnum } @marks.count.times do |n| if n == 0 @marks[n] += 1 else @marks[n] = 0 end end end |
#next_minor_version! ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/rake_tasks/gem.rb', line 56 def next_minor_version! @marks = @marks.select { |m| m.class == Fixnum } @marks.count.times do |n| case n when 0 @marks[n] = @marks[n] when 1 @marks[n] += 1 else @marks[n] = 0 end end end |
#next_revision! ⇒ Object
51 52 53 54 |
# File 'lib/rake_tasks/gem.rb', line 51 def next_revision! @marks = @marks.select { |m| m.class == Fixnum } @marks[-1] += 1 end |
#to_s ⇒ Object
81 82 83 |
# File 'lib/rake_tasks/gem.rb', line 81 def to_s @marks.join('.') end |