Class: Bosh::Cli::PublicStemcell
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(key, size) ⇒ PublicStemcell
constructor
A new instance of PublicStemcell.
- #legacy? ⇒ Boolean
- #name ⇒ Object
- #url ⇒ Object
- #variety ⇒ Object
- #version ⇒ Object
Constructor Details
#initialize(key, size) ⇒ PublicStemcell
Returns a new instance of PublicStemcell.
5 6 7 8 9 10 |
# File 'lib/cli/public_stemcell.rb', line 5 def initialize(key, size) @key = key @size = size @parsed_version = key.scan(/[\d]*_?[\d]+/).first end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
3 4 5 |
# File 'lib/cli/public_stemcell.rb', line 3 def size @size end |
Instance Method Details
#legacy? ⇒ Boolean
28 29 30 |
# File 'lib/cli/public_stemcell.rb', line 28 def legacy? @key.include?('legacy') end |
#name ⇒ Object
12 13 14 |
# File 'lib/cli/public_stemcell.rb', line 12 def name File.basename(@key) end |
#url ⇒ Object
24 25 26 |
# File 'lib/cli/public_stemcell.rb', line 24 def url "#{PublicStemcells::PUBLIC_STEMCELLS_BASE_URL}/#{@key}" end |
#variety ⇒ Object
20 21 22 |
# File 'lib/cli/public_stemcell.rb', line 20 def variety name.gsub(/(.tgz)|(bosh-stemcell-)|(#{@parsed_version})/, '').split('-').reject { |c| c.empty? }.join('-') end |
#version ⇒ Object
16 17 18 |
# File 'lib/cli/public_stemcell.rb', line 16 def version @parsed_version.gsub('_', '.').to_f end |