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