Class: RailsPipeline::PipelineVersion
- Inherits:
-
Object
- Object
- RailsPipeline::PipelineVersion
- Includes:
- Comparable
- Defined in:
- lib/rails-pipeline/pipeline_version.rb
Overview
A thin wrapper around our version object A version has the form X_Y where
- X is the major version
- Y is the minor version
example: 1_0, 2_1, etc…
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(version_string) ⇒ PipelineVersion
constructor
A new instance of PipelineVersion.
- #to_s ⇒ Object
Constructor Details
#initialize(version_string) ⇒ PipelineVersion
Returns a new instance of PipelineVersion.
14 15 16 17 |
# File 'lib/rails-pipeline/pipeline_version.rb', line 14 def initialize(version_string) # raise error? @major, @minor = version_string.split('_').map(&:to_i) end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
12 13 14 |
# File 'lib/rails-pipeline/pipeline_version.rb', line 12 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
12 13 14 |
# File 'lib/rails-pipeline/pipeline_version.rb', line 12 def minor @minor end |
Instance Method Details
#<=>(other) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/rails-pipeline/pipeline_version.rb', line 23 def <=>(other) if major == other.major return minor <=> other.minor else return major <=> other.major end end |
#eql?(other) ⇒ Boolean
31 32 33 |
# File 'lib/rails-pipeline/pipeline_version.rb', line 31 def eql?(other) return to_s.eql?(other.to_s) end |
#hash ⇒ Object
35 36 37 |
# File 'lib/rails-pipeline/pipeline_version.rb', line 35 def hash return to_s.hash end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/rails-pipeline/pipeline_version.rb', line 19 def to_s "#{major}_#{minor}" end |