Class: JBundle::Version
- Inherits:
-
Object
- Object
- JBundle::Version
- Defined in:
- lib/jbundle/writer.rb
Instance Method Summary collapse
- #full ⇒ Object
-
#initialize(string) ⇒ Version
constructor
A new instance of Version.
- #inspect ⇒ Object
- #major_minor ⇒ Object
- #releaseable ⇒ Object
- #to_s ⇒ Object
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
#full ⇒ Object
10 11 12 |
# File 'lib/jbundle/writer.rb', line 10 def full [@major, @minor, @patch].join('.') end |
#inspect ⇒ Object
26 27 28 |
# File 'lib/jbundle/writer.rb', line 26 def inspect "[JBundle::Version] #{full}" end |
#major_minor ⇒ Object
14 15 16 |
# File 'lib/jbundle/writer.rb', line 14 def major_minor [@major, @minor].join('.') end |
#releaseable ⇒ Object
18 19 20 |
# File 'lib/jbundle/writer.rb', line 18 def releaseable prerelease? ? [full] : [full, major_minor] end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/jbundle/writer.rb', line 22 def to_s full end |