Class: Fog::Brightbox::Compute::ImageSelector::NameSorter
- Inherits:
-
Object
- Object
- Fog::Brightbox::Compute::ImageSelector::NameSorter
- Defined in:
- lib/fog/brightbox/compute/image_selector.rb
Constant Summary collapse
- PATTERN =
/\A(?<ubuntu>.*?)-(?<codename>.*?)-(?<version>[\d\.]*?)-(?<arch>.*?)/
Instance Method Summary collapse
- #arch ⇒ Object
- #codename ⇒ Object
-
#initialize(name) ⇒ NameSorter
constructor
A new instance of NameSorter.
- #ubuntu? ⇒ Boolean
- #version ⇒ Object
Constructor Details
#initialize(name) ⇒ NameSorter
Returns a new instance of NameSorter.
62 63 64 65 |
# File 'lib/fog/brightbox/compute/image_selector.rb', line 62 def initialize(name) @name = name @matches = name.match(PATTERN) end |
Instance Method Details
#arch ⇒ Object
67 68 69 |
# File 'lib/fog/brightbox/compute/image_selector.rb', line 67 def arch @matches[:arch] || "" end |
#codename ⇒ Object
71 72 73 |
# File 'lib/fog/brightbox/compute/image_selector.rb', line 71 def codename @matches[:codename] || "" end |
#ubuntu? ⇒ Boolean
75 76 77 |
# File 'lib/fog/brightbox/compute/image_selector.rb', line 75 def ubuntu? @name.start_with?("ubuntu") end |
#version ⇒ Object
79 80 81 |
# File 'lib/fog/brightbox/compute/image_selector.rb', line 79 def version @matches[:version] || "" end |