class Version
Attributes
contents[RW]
path[R]
version[R]
Public Class Methods
new(path)
click to toggle source
# File lib/updater/version.rb, line 7 def initialize(path) @path = path @version = @path.split(File::SEPARATOR).last @contents = fetch_podspec end
Public Instance Methods
<=>(other)
click to toggle source
# 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()
click to toggle source
# File lib/updater/version.rb, line 13 def save File.write(podspec_path, JSON.pretty_generate(@contents)) end
Private Instance Methods
fetch_podspec()
click to toggle source
# File lib/updater/version.rb, line 33 def fetch_podspec file = File.read(podspec_path) JSON.parse(file) end
podspec_path()
click to toggle source
# File lib/updater/version.rb, line 25 def podspec_path filepath = Dir.glob(File.join(@path, '*')).first unless filepath.end_with? 'podspec.json' raise "Couldn't find podspec file, got #{filepath}" end filepath end