Module: AppKernel::Function::ClassMethods
- Defined in:
- lib/appkernel/function.rb
Instance Method Summary collapse
- #apply(*args) ⇒ Object
- #call(*args) ⇒ Object
- #option(name, modifiers = {}) ⇒ Object
- #options ⇒ Object
- #prepare! ⇒ Object
Instance Method Details
#apply(*args) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/appkernel/function.rb', line 90 def apply(*args) Result.new.tap do |result| @options.canonicalize(args, result.errors).tap do |params| if result.successful? new(params).tap do |function| function.validate(Validator.new(result.errors)) if result.successful? result.return_value = function.execute end end end end end end |
#call(*args) ⇒ Object
84 85 86 87 88 |
# File 'lib/appkernel/function.rb', line 84 def call(*args) apply(*args).tap {|result| result.verify! }.return_value end |
#option(name, modifiers = {}) ⇒ Object
76 77 78 |
# File 'lib/appkernel/function.rb', line 76 def option(name, modifiers = {}) @options.add(name, modifiers) end |
#options ⇒ Object
72 73 74 |
# File 'lib/appkernel/function.rb', line 72 def @options end |