Class: CSD::Commands::CommandResult

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/csd/commands.rb

Overview

Objects of this class can be returned by Commands. Since it is an OpenStruct object, it can contain an arbritary number of values.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object

This creates an convenient, read-only accessor for the OpenStruct object values. It simply maps methods that end with a ? to the same method without ?.

Examples

command_result.something? # => command_result.something


27
28
29
# File 'lib/csd/commands.rb', line 27

def method_missing(meth, *args, &block)
  meth.to_s.ends_with?('?') ? self.send(meth.to_s.chop.to_sym, *args, &block) : super
end