Class: JBundle::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/jbundle/writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Version

Returns a new instance of Version.



5
6
7
8
# File 'lib/jbundle/writer.rb', line 5

def initialize(string)
  @major, @minor, @patch = string.split('.')
  raise "require (major.minor.patch) eg: 1.3.1" unless @major && @minor && @patch
end

Instance Method Details

#fullObject



10
11
12
# File 'lib/jbundle/writer.rb', line 10

def full
  [@major, @minor, @patch].join('.')
end

#inspectObject



26
27
28
# File 'lib/jbundle/writer.rb', line 26

def inspect
  "[JBundle::Version] #{full}"
end

#major_minorObject



14
15
16
# File 'lib/jbundle/writer.rb', line 14

def major_minor 
  [@major, @minor].join('.')
end

#releaseableObject



18
19
20
# File 'lib/jbundle/writer.rb', line 18

def releaseable
  prerelease? ? [full] : [full, major_minor]
end

#to_sObject



22
23
24
# File 'lib/jbundle/writer.rb', line 22

def to_s
  full
end