Module: Logicall
- Defined in:
- lib/logicall.rb,
lib/logicall/args.rb,
lib/logicall/result.rb,
lib/logicall/version.rb
Overview
Examples
class HelloWorld
include Logicall
def call args
puts "Hello #{args.author}"
end
end
Usage
HelloWorld.call author: "Andrew"
Defined Under Namespace
Modules: ClassMethods Classes: Args, Result
Constant Summary collapse
- VERSION =
"1.0.0"
Class Method Summary collapse
Instance Method Summary collapse
-
#call(args) ⇒ Object
Should be implemented in your Logicall implementation.
-
#result ⇒ Object
Getter to the result object.
-
#rollback(args) ⇒ Object
Called automaticaly when the result is marked as fail!.
Class Method Details
.included(base) ⇒ Object
20 21 22 23 24 |
# File 'lib/logicall.rb', line 20 def self.included(base) base.class_eval do extend ClassMethods end end |
Instance Method Details
#call(args) ⇒ Object
Should be implemented in your Logicall implementation
27 28 29 |
# File 'lib/logicall.rb', line 27 def call args raise "you should implement this method" end |
#result ⇒ Object
Getter to the result object
37 38 39 |
# File 'lib/logicall.rb', line 37 def result @result ||= Result.new end |
#rollback(args) ⇒ Object
Called automaticaly when the result is marked as fail!
32 33 34 |
# File 'lib/logicall.rb', line 32 def rollback args # does nothing end |