Module: Sprinkle::Attributes

Extended by:
ActiveSupport::Concern
Included in:
Installers::Installer, Verify
Defined in:
lib/sprinkle/extensions/attributes.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#defaults(deployment) ⇒ Object


9
10
11
12
13
# File 'lib/sprinkle/extensions/attributes.rb', line 9

def defaults(deployment)
  defaults = deployment.defaults[self.class.name.split(/::/).last.downcase.to_sym]
  self.set_defaults(&defaults) if defaults
  @delivery = deployment.style
end

#set_defaults(&block) ⇒ Object


15
16
17
18
19
20
# File 'lib/sprinkle/extensions/attributes.rb', line 15

def set_defaults(&block)
  before = @options
  @options = {}
  self.instance_eval(&block) if block
  @options = before.reverse_merge(@options)
end