Class: Version
- Inherits:
-
Object
- Object
- Version
- Defined in:
- lib/updater/version.rb
Instance Attribute Summary collapse
-
#contents ⇒ Object
Returns the value of attribute contents.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
-
#initialize(path:) ⇒ Version
constructor
A new instance of Version.
- #save ⇒ Object
Constructor Details
#initialize(path:) ⇒ Version
Returns a new instance of Version.
7 8 9 10 11 |
# File 'lib/updater/version.rb', line 7 def initialize(path:) @path = path @version = @path.split(File::SEPARATOR).last @contents = fetch_podspec end |
Instance Attribute Details
#contents ⇒ Object
Returns the value of attribute contents.
5 6 7 |
# File 'lib/updater/version.rb', line 5 def contents @contents end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/updater/version.rb', line 4 def path @path end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
4 5 6 |
# File 'lib/updater/version.rb', line 4 def version @version end |
Instance Method Details
#<=>(other) ⇒ Object
17 18 19 20 21 |
# File 'lib/updater/version.rb', line 17 def <=>(other) own_version = @version.split('.').map(&:to_i) other_version = other.version.split('.').map(&:to_i) own_version <=> other_version end |
#save ⇒ Object
13 14 15 |
# File 'lib/updater/version.rb', line 13 def save File.write(podspec_path, JSON.pretty_generate(@contents)) end |