Class: ChefNotifier::Version

Inherits:
Object
  • Object
show all
Defined in:
lib/chef-notifier/version.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#majorObject (readonly)

Returns the value of attribute major.



4
5
6
# File 'lib/chef-notifier/version.rb', line 4

def major
  @major
end

#minorObject (readonly)

Returns the value of attribute minor.



4
5
6
# File 'lib/chef-notifier/version.rb', line 4

def minor
  @minor
end

#tinyObject (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_sObject



11
12
13
# File 'lib/chef-notifier/version.rb', line 11

def to_s
  "#{@major}.#{@minor}.#{@tiny}"
end