Module: BeanStalk::Worker::Version
- Includes:
- Comparable
- Defined in:
- lib/beanstalk-worker/version_class.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#patch ⇒ Object
readonly
Returns the value of attribute patch.
Instance Method Summary collapse
- #<=>(v) ⇒ Object
-
#eql?(other) ⇒ Boolean
For hash.
- #hash ⇒ Object
- #initialize(str = "") ⇒ Object
- #inspect ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
5 6 7 |
# File 'lib/beanstalk-worker/version_class.rb', line 5 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
5 6 7 |
# File 'lib/beanstalk-worker/version_class.rb', line 5 def minor @minor end |
#patch ⇒ Object (readonly)
Returns the value of attribute patch.
5 6 7 |
# File 'lib/beanstalk-worker/version_class.rb', line 5 def patch @patch end |
Instance Method Details
#<=>(v) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/beanstalk-worker/version_class.rb', line 19 def <=>(v) [:major, :minor, :patch].each do |method| ans = (self.send(method) <=> v.send(method)) return ans if ans != 0 end 0 end |
#eql?(other) ⇒ Boolean
For hash
32 33 34 |
# File 'lib/beanstalk-worker/version_class.rb', line 32 def eql?(other) other.is_a?(Version) && self == other end |
#hash ⇒ Object
27 28 29 |
# File 'lib/beanstalk-worker/version_class.rb', line 27 def hash to_s.hash end |
#initialize(str = "") ⇒ Object
7 8 9 |
# File 'lib/beanstalk-worker/version_class.rb', line 7 def initialize(str="") parse(str) end |
#inspect ⇒ Object
11 12 13 |
# File 'lib/beanstalk-worker/version_class.rb', line 11 def inspect "#{@major}.#{@minor}.#{@patch}" end |
#to_s ⇒ Object
15 16 17 |
# File 'lib/beanstalk-worker/version_class.rb', line 15 def to_s "#{@major}.#{@minor}.#{@patch}" end |