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

- (Object) method_missing(sym, *args, &block)



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

- (Object) delivery

Returns the value of attribute delivery



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

def delivery
  @delivery
end

Instance Method Details

- (Object) assert_delivery



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

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

- (Object) defaults(deployment)



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

- (Boolean) option?(sym)

Returns:

  • (Boolean)


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

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