Class: XcodeInstall::Xcode
- Inherits:
-
Object
- Object
- XcodeInstall::Xcode
- Defined in:
- lib/xcode/install.rb
Instance Attribute Summary collapse
-
#date_modified ⇒ Object
readonly
Returns the value of attribute date_modified.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(json) ⇒ Xcode
constructor
A new instance of Xcode.
- #to_s ⇒ Object
Constructor Details
#initialize(json) ⇒ Xcode
Returns a new instance of Xcode.
267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/xcode/install.rb', line 267 def initialize(json) @date_modified = json['dateModified'].to_i @name = json['name'].gsub(/^Xcode /, '') @path = json['files'].first['remotePath'] @url = "https://developer.apple.com/devcenter/download.action?path=#{@path}" begin @version = Gem::Version.new(@name.split(' ')[0]) rescue @version = Installer::MINIMUM_VERSION end end |
Instance Attribute Details
#date_modified ⇒ Object (readonly)
Returns the value of attribute date_modified.
261 262 263 |
# File 'lib/xcode/install.rb', line 261 def date_modified @date_modified end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
262 263 264 |
# File 'lib/xcode/install.rb', line 262 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
263 264 265 |
# File 'lib/xcode/install.rb', line 263 def path @path end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
264 265 266 |
# File 'lib/xcode/install.rb', line 264 def url @url end |
#version ⇒ Object (readonly)
Returns the value of attribute version.
265 266 267 |
# File 'lib/xcode/install.rb', line 265 def version @version end |
Class Method Details
.new_prelease(version, url) ⇒ Object
289 290 291 292 293 |
# File 'lib/xcode/install.rb', line 289 def self.new_prelease(version, url) new('name' => version, 'dateModified' => Time.now.to_i, 'files' => [{ 'remotePath' => url.split('=').last }]) end |
Instance Method Details
#==(other) ⇒ Object
284 285 286 287 |
# File 'lib/xcode/install.rb', line 284 def ==(other) date_modified == other.date_modified && name == other.name && path == other.path && \ url == other.url && version == other.version end |
#to_s ⇒ Object
280 281 282 |
# File 'lib/xcode/install.rb', line 280 def to_s "Xcode #{version} -- #{url}" end |