Module: Smash::CloudPowers::Creatable::AfterHooks
- Defined in:
- lib/cloud_powers/creatable.rb
Instance Method Summary collapse
-
#linked? ⇒ Boolean
Alternative to
save!(). -
#save! ⇒ Object
An
after_hookstyle method that sends a reqeust to your custom implementation of thecreate_resourcemethodallows you to do things after you create the resource, in the cloud. -
#saved? ⇒ Boolean
Find out if the resource was created.
Instance Method Details
#linked? ⇒ Boolean
Alternative to save!(). This predicate method is based off the @linked i-var and is set to true after it has been confirmed that this resource is a good map to the resource in the cloud.
Returns
-
Boolean
91 92 93 |
# File 'lib/cloud_powers/creatable.rb', line 91 def linked? !!@linked end |
#save! ⇒ Object
An after_hook style method that sends a reqeust to your custom implementation of the create_resource methodallows you to do things after you create the resource, in the cloud. This method relies on you having a create_resource method that can handle every aspect of creating your resource. If this piece of the contract isn’t obeyed, you will receive a NoMethodError.
Returns Boolean - true if the resource
104 105 106 107 |
# File 'lib/cloud_powers/creatable.rb', line 104 def save! resp = create_resource if self.respond_to? :create_resource @saved = !resp.nil? end |
#saved? ⇒ Boolean
Find out if the resource was created
Returns Boolean
113 114 115 |
# File 'lib/cloud_powers/creatable.rb', line 113 def saved? !!@saved end |