Class: PoolParty::Resources::Classpackage
- Defined in:
- lib/poolparty/pool/resources/class_package.rb
Instance Method Summary collapse
- #include_string ⇒ Object
-
#initialize(opts = {}, parent = self, &block) ⇒ Classpackage
constructor
A new instance of Classpackage.
- #to_string ⇒ Object
Methods inherited from Resource
#absent, available_resource_methods, available_resources, #class_type_name, custom_function, #custom_function, custom_functions, custom_functions_to_string, #disallowed_options, #ensures, #get_modified_options, #ifnot, inherited, #is_absent, #is_present, #key, #loaded, #present, #requires, #template, #virtual_resource?
Methods included from PoolParty::Resources
add_has_and_does_not_have_methods_for, #add_resource, #call_function, #classpackage_with_self, #custom_file, custom_function, #custom_function, #gem, #get_resource, #reset_resources!, #resource, #resources, #resources_string, #resources_string_from_resources
Methods included from Configurable
Methods included from CloudResourcer
#full_keypair_path, #instances, #keypair_path, #keypair_paths, #new_keypair_path, #number_of_resources, #parent, #possible_keypair_basenames, #set_parent
Constructor Details
#initialize(opts = {}, parent = self, &block) ⇒ Classpackage
Returns a new instance of Classpackage.
18 19 20 21 22 23 24 25 |
# File 'lib/poolparty/pool/resources/class_package.rb', line 18 def initialize(opts={}, parent=self, &block) # Take the options of the parents (opts) unless opts.empty? self.instance_eval &block if block set_parent(parent) if parent loaded end |
Instance Method Details
#include_string ⇒ Object
36 37 38 |
# File 'lib/poolparty/pool/resources/class_package.rb', line 36 def include_string "include #{@parent.name.sanitize}" end |
#to_string ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/poolparty/pool/resources/class_package.rb', line 27 def to_string returning String.new do |output| output << "# #{@parent.name.sanitize}" output << "\nclass #{@parent.name.sanitize} {\n" output << resources_string_from_resources(resources) output << "\n}\n" end end |