Module: Sprinkle::Configurable
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? @options ||= {}
@options[sym] = *args unless @options[sym]
end
@options[sym] || @package.send(sym, *args, &block) end
|
Instance Attribute Details
6
7
8
|
# File 'lib/sprinkle/configurable.rb', line 6
def delivery
@delivery
end
|
Instance Method Details
#assert_delivery ⇒ Object
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
27
28
29
|
# File 'lib/sprinkle/configurable.rb', line 27
def option?(sym)
!@options[sym].nil?
end
|