Class: AtlassianAppVersions::AbstractVersion
- Inherits:
-
Object
- Object
- AtlassianAppVersions::AbstractVersion
show all
- Includes:
- Comparable
- Defined in:
- lib/atlassian_app_versions.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(versionName, parent) ⇒ AbstractVersion
Returns a new instance of AbstractVersion.
288
289
290
291
|
# File 'lib/atlassian_app_versions.rb', line 288
def initialize(versionName, parent)
@version = versionName
@parent = parent
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
325
326
327
328
329
330
331
|
# File 'lib/atlassian_app_versions.rb', line 325
def method_missing(name, *args, &block)
if versionJSON and versionJSON.keys.member? name.to_s then
versionJSON[name.to_s]
else
super
end
end
|
Instance Attribute Details
#version ⇒ Object
Returns the value of attribute version.
287
288
289
|
# File 'lib/atlassian_app_versions.rb', line 287
def version
@version
end
|
Instance Method Details
#<=>(other_version) ⇒ Object
309
310
311
312
313
314
315
316
317
318
319
|
# File 'lib/atlassian_app_versions.rb', line 309
def <=>(other_version)
v1 = @version.gsub('_', '.')
v2 = other_version.to_s.gsub('_', '.')
begin
Gem::Version.new(v1) <=> Gem::Version.new(v2)
rescue ArgumentError => e
$stderr.puts e.message
end
end
|
#inspect ⇒ Object
301
302
303
|
# File 'lib/atlassian_app_versions.rb', line 301
def inspect
"#<#{self.class.name}:#{self.object_id} #{to_s}>"
end
|
#keys ⇒ Object
321
322
323
|
# File 'lib/atlassian_app_versions.rb', line 321
def keys
versionJSON.keys
end
|
#releaseDate ⇒ Object
297
298
299
|
# File 'lib/atlassian_app_versions.rb', line 297
def releaseDate
DateTime.strptime(versionJSON["releaseDate"], '%Y-%m-%dT%H:%M:%S.%L%z') if versionJSON
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
333
334
335
|
# File 'lib/atlassian_app_versions.rb', line 333
def respond_to_missing?(name, include_private = false)
keys.member? name.to_s || super
end
|
#to_s ⇒ Object
305
306
307
|
# File 'lib/atlassian_app_versions.rb', line 305
def to_s
@version
end
|
#versionJSON ⇒ Object
293
294
295
|
# File 'lib/atlassian_app_versions.rb', line 293
def versionJSON
@parent.versionsJSON.find { |v| v["version"] == @version }
end
|