Module: Smash::CloudPowers::Creatable

Includes:
Helpers
Included in:
Resource
Defined in:
lib/cloud_powers/creatable.rb

Overview

Give an object an Active Record-like interface, with a twist. Instead of a database, we’re using cloud resources. This module includes handy methods that can act like before and after hooks, for object instantiation and cloud-resource creation. To use the module, you have to participate in the interface, which means you have to follow a few rules:

1. your +initialize+ method can take a list of keyword arguments or a +Hash+
for configuration
2. your resource class has a <tt>create_resource</tt> method that can
deal with making the http request for creating the resource in the cloud
3. your class extends this module

Defined Under Namespace

Modules: AfterHooks, BeforeHooks

Class Method Summary collapse

Methods included from Helpers

#create_logger, #log_file, #logger

Methods included from PathHelp

#job_exist?, #job_home, #job_path, #job_require_path

Methods included from LogicHelp

#attr_map, #called_from, #instance_attr_accessor, #smart_retry, #update_message_body

Methods included from LangHelp

#deep_modify_keys_with, #find_and_remove, #format_error_message, #from_json, #modify_keys_with, #to_basic_hash, #to_camel, #to_hyph, #to_i_var, #to_pascal, #to_ruby_file_name, #to_snake, #valid_json?, #valid_url?

Class Method Details

.included(base) ⇒ Object



19
20
21
22
# File 'lib/cloud_powers/creatable.rb', line 19

def self.included base
  base.send :include, AfterHooks
  base.extend BeforeHooks
end