Module: SnowyOwl::Determinations
- Defined in:
- lib/snowy_owl/determinations.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/snowy_owl/determinations.rb', line 10
def method_missing(name, *args, &block)
context_key = name.to_s.gsub /determine_/, ''
determine_context = SnowyOwl.determine_context context_key.downcase.to_sym
if determine_context.nil?
super(name, *args, &block)
else
args.unshift context_key.tr('_', ' ')
instance_exec(*args, &determine_context)
end
end
|
Class Method Details
.determine(name, &block) ⇒ Object
6
7
8
|
# File 'lib/snowy_owl/determinations.rb', line 6
def self.determine(name, &block)
SnowyOwl.determine_context SnowyOwl::Support.to_underscore(name).to_sym, &block
end
|