Class: Command::OgCommands::OgModeCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/command-set/og.rb

Class Method Summary collapse

Methods included from Command

raw_stderr, raw_stdout, wrap_stderr, wrap_stdout

Class Method Details

.mode(command_set) ⇒ Object



66
67
68
69
70
71
# File 'lib/command-set/og.rb', line 66

def mode(command_set)
  define_method(:my_mode) do
           command_set.set_prompt(/$/, "#{found_current} : ")
    return command_set
  end
end

.switch_to(model_class, find_by, og_options = {}) ⇒ Object



57
58
59
60
61
62
63
64
# File 'lib/command-set/og.rb', line 57

def switch_to(model_class, find_by, og_options={})
  og_options.merge!(:create_missing => true)
  argument OgArgument.new(:current, model_class, find_by, og_options)

         define_method(:found_current) do
           current.__send__(find_by)
         end
end