Class: Hazetug::Compute::Base
- Inherits:
-
Object
- Object
- Hazetug::Compute::Base
- Defined in:
- lib/hazetug/compute.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Base
constructor
A new instance of Base.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Base
Returns a new instance of Base.
36 37 38 39 |
# File 'lib/hazetug/compute.rb', line 36 def initialize(*args) klass = self.class.name.split('::').last @fog = Fog::Compute.const_get(klass).new(*args) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/hazetug/compute.rb', line 41 def method_missing(method_name, *args, &block) # cache all missing methods calls self.class.module_eval <<-EOS, __FILE__, __LINE__ def #{method_name}(*args, &block) fog.#{method_name}(*args, &block) end EOS fog.send(method_name, *args, &block) end |
Class Method Details
.collection_map(mapping) ⇒ Object
52 53 54 55 56 57 |
# File 'lib/hazetug/compute.rb', line 52 def collection_map(mapping) @collection_map = mapping unless const_defined?(:CollectionMap) module_eval "CollectionMap = @collection_map" end end |