Module: SimpleCommandDispatcher::Commands::CommandCallable
- Defined in:
- lib/simple_command_dispatcher/commands/utils.rb,
lib/simple_command_dispatcher/commands/errors.rb,
lib/simple_command_dispatcher/commands/command_callable.rb
Defined Under Namespace
Modules: ClassMethods, Utils
Classes: Errors, NotImplementedError
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
8
9
10
|
# File 'lib/simple_command_dispatcher/commands/command_callable.rb', line 8
def result
@result
end
|
Class Method Details
.prepended(base) ⇒ Object
17
18
19
|
# File 'lib/simple_command_dispatcher/commands/command_callable.rb', line 17
def self.prepended(base)
base.extend ClassMethods
end
|
Instance Method Details
#call ⇒ Object
21
22
23
24
25
26
27
28
|
# File 'lib/simple_command_dispatcher/commands/command_callable.rb', line 21
def call
raise NotImplementedError unless defined?(super)
@called = true
@result = super
self
end
|
#errors ⇒ Object
39
40
41
42
43
|
# File 'lib/simple_command_dispatcher/commands/command_callable.rb', line 39
def errors
return super if defined?(super)
@errors ||= Errors.new
end
|
#failure? ⇒ Boolean
35
36
37
|
# File 'lib/simple_command_dispatcher/commands/command_callable.rb', line 35
def failure?
called? && errors.any?
end
|
#success? ⇒ Boolean
Also known as:
successful?
30
31
32
|
# File 'lib/simple_command_dispatcher/commands/command_callable.rb', line 30
def success?
called? && !failure?
end
|