Module: Corrupt::ClientHelpers

Included in:
Client
Defined in:
lib/corrupt/client/helpers.rb

Instance Method Summary collapse

Instance Method Details

#error(message, stream = $stderr) ⇒ Object

Output an error message to stream (defaults to $stderr).



5
6
7
# File 'lib/corrupt/client/helpers.rb', line 5

def error(message, stream = $stderr)
  stream.puts message
end

#output(string, opts = {}) ⇒ Object

Output string to opts[:stream] using opts[:method].



10
11
12
13
14
# File 'lib/corrupt/client/helpers.rb', line 10

def output(string, opts = {})
  opts[:method] ||= 'puts'
  opts[:stream] ||= $stdout
  opts[:stream].send(opts[:method], string)
end

#take_action!Object



16
17
18
# File 'lib/corrupt/client/helpers.rb', line 16

def take_action!
  Corrupt::Generators::App.new(@options[:path]) if @options[:path]
end