Class: ChefNotifier::Version
- Inherits:
-
Object
- Object
- ChefNotifier::Version
- Defined in:
- lib/chef-notifier/version.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#tiny ⇒ Object
readonly
Returns the value of attribute tiny.
Instance Method Summary collapse
-
#initialize(version) ⇒ Version
constructor
A new instance of Version.
- #to_s ⇒ Object
Constructor Details
#initialize(version) ⇒ Version
Returns a new instance of Version.
6 7 8 9 |
# File 'lib/chef-notifier/version.rb', line 6 def initialize(version) version = version.split('.') @major, @minor, @tiny = [version[0].to_i, version[1].to_i, version[2].to_i] end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
4 5 6 |
# File 'lib/chef-notifier/version.rb', line 4 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
4 5 6 |
# File 'lib/chef-notifier/version.rb', line 4 def minor @minor end |
#tiny ⇒ Object (readonly)
Returns the value of attribute tiny.
4 5 6 |
# File 'lib/chef-notifier/version.rb', line 4 def tiny @tiny end |
Instance Method Details
#to_s ⇒ Object
11 12 13 |
# File 'lib/chef-notifier/version.rb', line 11 def to_s "#{@major}.#{@minor}.#{@tiny}" end |