Module: Excom::Plugins::Executable
- Defined in:
- lib/excom/plugins/executable.rb
Defined Under Namespace
Modules: ClassMethods
Classes: Result
Instance Method Summary
collapse
Instance Method Details
#execute(&block) ⇒ Object
19
20
21
22
23
24
25
26
|
# File 'lib/excom/plugins/executable.rb', line 19
def execute(*, &block)
clear_execution_state!
result = run(&block)
result_with(result) unless defined? @result
@executed = true
self
end
|
#executed? ⇒ Boolean
28
29
30
|
# File 'lib/excom/plugins/executable.rb', line 28
def executed?
@executed
end
|
#failure? ⇒ Boolean
81
82
83
|
# File 'lib/excom/plugins/executable.rb', line 81
def failure?
!success?
end
|
#initialize ⇒ Object
10
11
12
13
|
# File 'lib/excom/plugins/executable.rb', line 10
def initialize(*)
@executed = false
super
end
|
#initialize_clone ⇒ Object
15
16
17
|
# File 'lib/excom/plugins/executable.rb', line 15
def initialize_clone(*)
clear_execution_state!
end
|
#result(obj = UNDEFINED) ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/excom/plugins/executable.rb', line 46
def result(obj = UNDEFINED)
return @result if obj == UNDEFINED
case obj
when Hash
if obj.length != 1
fail ArgumentError, "expected 1-item status-result pair, got: #{obj.inspect}"
end
@status, @result = obj.first
else
result_with(obj)
end
end
|
#status(status = UNDEFINED) ⇒ Object
71
72
73
74
75
|
# File 'lib/excom/plugins/executable.rb', line 71
def status(status = UNDEFINED)
return @status = status unless status == UNDEFINED
@status
end
|
#success? ⇒ Boolean
77
78
79
|
# File 'lib/excom/plugins/executable.rb', line 77
def success?
status == :success || self.class.success_aliases.include?(status)
end
|
#~@ ⇒ Object
32
33
34
|
# File 'lib/excom/plugins/executable.rb', line 32
def ~@
Result.new(status, result)
end
|