Module: SimpleCommand
- Defined in:
- lib/simple_command.rb,
lib/simple_command/errors.rb,
lib/simple_command/version.rb
Defined Under Namespace
Modules: ClassMethods
Classes: Errors, NotImplementedError
Constant Summary
collapse
- VERSION =
'0.0.7'
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Instance Attribute Details
#result ⇒ Object
Returns the value of attribute result.
5
6
7
|
# File 'lib/simple_command.rb', line 5
def result
@result
end
|
Class Method Details
.prepended(base) ⇒ Object
13
14
15
|
# File 'lib/simple_command.rb', line 13
def self.prepended(base)
base.extend ClassMethods
end
|
Instance Method Details
#errors ⇒ Object
34
35
36
|
# File 'lib/simple_command.rb', line 34
def errors
@errors ||= Errors.new
end
|
#failure? ⇒ Boolean
30
31
32
|
# File 'lib/simple_command.rb', line 30
def failure?
performed? && errors.any?
end
|
17
18
19
20
21
22
23
24
|
# File 'lib/simple_command.rb', line 17
def perform
fail NotImplementedError unless defined?(super)
@performed = true
@result = super
self
end
|
#success? ⇒ Boolean
26
27
28
|
# File 'lib/simple_command.rb', line 26
def success?
performed? && !failure?
end
|