Skip to content

Commit

Permalink
be compatible with 0.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
janlelis committed Nov 17, 2010
1 parent e1ef837 commit f5e1fb5
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions lib/ripl/multi_line.rb
Expand Up @@ -12,12 +12,12 @@ def prompt
@buffer ? config[:multi_line_prompt] : super
end

def loop_once
catch(:multiline) do
super
@buffer = nil
end
end
#def loop_once
# catch(:multiline) do
# super
# @buffer = nil
# end
#end

def print_eval_error(e)
if e.is_a?(SyntaxError) && e.message =~ /unexpected \$end|unterminated string meets end of file/
Expand All @@ -28,10 +28,27 @@ def print_eval_error(e)
end
end

#def eval_input(input)
# super(@buffer ? @buffer + input : input)
#end
end

# non-plugin api hack
class Shell
alias loop_once_without_multiline loop_once
def loop_once
catch(:multiline) do
loop_once_without_multiline
@buffer = nil
end
end

alias eval_input_without_multiline eval_input
def eval_input(input)
super(@buffer ? @buffer + input : input)
eval_input_without_multiline(@buffer ? @buffer + input : input)
end
end

end

Ripl::Shell.send :include, Ripl::MultiLine if defined? Ripl::Shell
Expand Down

0 comments on commit f5e1fb5

Please sign in to comment.