Class: PoolParty::Service
- Inherits:
-
PoolPartyBaseClass
- Object
- PoolPartyBaseClass
- PoolParty::Service
- Defined in:
- lib/poolparty/poolparty/service.rb
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #cloud ⇒ Object
-
#initialize(o = {}, &block) ⇒ Service
constructor
A new instance of Service.
Methods inherited from PoolPartyBaseClass
#add_resource, #add_service, #add_to_parent_if_parent_exists_and_is_a_service, #get_local_resource, #get_name_from_options_and_extra_options, #get_resource, #handle_option_values, #in_local_resources?, #is_a_resource?, #is_plugin?, #method_missing, #ordered_resources, #plugin_store, #resource, #resources, #run_in_context, #services, #store_in_local_resources
Methods included from DependencyResolverCloudExtensions
Constructor Details
#initialize(o = {}, &block) ⇒ Service
Returns a new instance of Service.
5 6 7 |
# File 'lib/poolparty/poolparty/service.rb', line 5 def initialize(o={}, &block) super(o, &block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class PoolParty::PoolPartyBaseClass
Class Method Details
.add_has_and_does_not_have_methods_for(typ = :file) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/poolparty/poolparty/service.rb', line 16 def self.add_has_and_does_not_have_methods_for(typ=:file) lowercase_class_name = typ.to_s.top_level_class.downcase meth = <<-EOM def __#{lowercase_class_name}(opts={}, &block) i = PoolParty::#{lowercase_class_name.camelcase}Class.new(opts, &block) plugin_store << i if respond_to?(:plugin_store) i end alias :#{lowercase_class_name} :__#{lowercase_class_name} EOM PoolParty::PoolPartyBaseClass.module_eval meth PoolParty::PoolPartyBaseClass.add_has_and_does_not_have_methods_for(lowercase_class_name.to_sym) end |
Instance Method Details
#cloud ⇒ Object
9 10 11 12 13 14 |
# File 'lib/poolparty/poolparty/service.rb', line 9 def cloud 2.upto(context_stack.size) do |i| return ::PoolParty.context_stack[-i] if ::PoolParty.context_stack[-i].is_a?(PoolParty::Cloud::Cloud) end nil end |