Module: ObjectiveCommand::Shell::MethodMissing

Included in:
Simple
Defined in:
lib/objective_command/shell.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/objective_command/shell.rb', line 17

def method_missing meth, *args, &block
  super if block
  meth = meth.to_s
  if meth =~ /^(.*)!$/
    raise 'No runner' unless respond_to? :runner or runner.nil?
    Object.send(:remove_const, :Commands) if defined? ::Commands
    Commands::Command.new($1, *args).run(runner)
  else
    cmd = Commands::Command.new(meth, *args)
    cmd.freeze if shell_options and shell_options[:frozen]
    cmd
  end
end