Module: Sprinkle::Configurable

Included in:
Installers::Installer, Verify
Defined in:
lib/sprinkle/configurable.rb

Overview

– TODO: Possible documentation? ++

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/sprinkle/configurable.rb', line 18

def method_missing(sym, *args, &block)
  unless args.empty? # mutate if not set
    @options ||= {}
    @options[sym] = *args unless @options[sym]
  end

  @options[sym] || @package.send(sym, *args, &block) # try the parents options if unknown
end

Instance Attribute Details

#deliveryObject

:nodoc:



6
7
8
# File 'lib/sprinkle/configurable.rb', line 6

def delivery
  @delivery
end

Instance Method Details

#assert_deliveryObject



14
15
16
# File 'lib/sprinkle/configurable.rb', line 14

def assert_delivery
  raise 'Unknown command delivery target' unless @delivery
end

#defaults(deployment) ⇒ Object



8
9
10
11
12
# File 'lib/sprinkle/configurable.rb', line 8

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

#option?(sym) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/sprinkle/configurable.rb', line 27

def option?(sym)
  !@options[sym].nil?
end