Class: CommandResultRefined
- Inherits:
-
Object
show all
- Defined in:
- lib/command_result_alternatives.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CommandResultRefined.
207
208
209
210
|
# File 'lib/command_result_alternatives.rb', line 207
def initialize(**attributes)
@attributes = { exit_status: 0, stdout: '' }.merge(attributes)
@attributes.extend(AttributeAccess::Hash)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
226
227
228
|
# File 'lib/command_result_alternatives.rb', line 226
def method_missing(name, *args)
@attributes.send(name, *args)
end
|
Instance Method Details
#failure? ⇒ Boolean
212
213
214
|
# File 'lib/command_result_alternatives.rb', line 212
def failure?
!success?
end
|
#new_lines=(value) ⇒ Object
Intercept specific setter
221
222
223
224
|
# File 'lib/command_result_alternatives.rb', line 221
def new_lines=(value)
warn caller.deref[0..4], value
@attributes.new_lines = value
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
230
231
232
|
# File 'lib/command_result_alternatives.rb', line 230
def respond_to_missing?(name, include_private = false)
@attributes.respond_to?(name, include_private)
end
|
#success? ⇒ Boolean
216
217
218
|
# File 'lib/command_result_alternatives.rb', line 216
def success?
@attributes.exit_status.zero?
end
|