lib/genspec/shell.rb in genspec-0.2.8 vs lib/genspec/shell.rb in genspec-0.3.0
- old
+ new
@@ -8,18 +8,10 @@
alias_method :input, :stdin
alias_method :input=, :stdin=
alias_method :output, :stdout
alias_method :output=, :stdout=
- Thor::Shell::SHELL_DELEGATED_METHODS.each do |method|
- eval <<-end_code
- def #{method}(*args, &block) # def yes?(*args, &block)
- push_std { super(*args, &block) } # push_std { super(*args, &block) }
- end # end
- end_code
- end
-
def ask(statement, color = nil)
say "#{statement} ", color
response = stdin.gets
if response
response.strip
@@ -40,16 +32,9 @@
@stderr = @stdout
self
end
private
- def push_std
- _stderr, _stdout, _stdin = $stderr, $stdout, $stdin
- $stderr, $stdout, $stdin = stderr, stdout, stdin
- yield
- ensure
- $stderr, $stdout, $stdin = _stderr, _stdout, _stdin
- end
def init_stream(which, value)
if value.kind_of?(String)
value = StringIO.new(value)
end
\ No newline at end of file