Method: Mothership#interact

Defined in:
lib/mothership/base.rb

#interact(input = nil, *args) ⇒ Object

explicitly perform the interaction of an input

if no input specified, assume current input and reuse the arguments

example:

input(:foo, :default => proc { |foos|
        foos.find { |f| f.name == "XYZ" } ||
          interact
      }) { |foos|
  ask("Foo?", :choices => foos, :display => proc(&:name))
}


90
91
92
93
94
95
96
97
98
# File 'lib/mothership/base.rb', line 90

def interact(input = nil, *args)
  unless input
    input, args = @input.current_input
  end

  raise "no active input" unless input

  @input.interact(input, self, *args)
end