ripl-multi_line 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +1 -1
- data/README.rdoc +1 -3
- data/lib/ripl/multi_line.rb +26 -26
- metadata +7 -7
data/.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.summary = "A ripl plugin for multi-line eval."
|
12
12
|
s.description = "This ripl plugin allows you to evaluate multiple lines of Ruby code."
|
13
13
|
s.required_rubygems_version = ">= 1.3.6"
|
14
|
-
s.add_dependency 'ripl', '>= 0.2.
|
14
|
+
s.add_dependency 'ripl', '>= 0.2.1'
|
15
15
|
s.files = Dir.glob(%w[{lib,test}/**/*.rb bin/* [A-Z]*.{txt,rdoc} ext/**/*.{rb,c} **/deps.rip]) + %w{Rakefile .gemspec}
|
16
16
|
s.extra_rdoc_files = ["README.rdoc", "LICENSE.txt"]
|
17
17
|
s.license = 'MIT'
|
data/README.rdoc
CHANGED
data/lib/ripl/multi_line.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
module Ripl
|
2
2
|
module MultiLine
|
3
|
-
VERSION = '0.1.
|
3
|
+
VERSION = '0.1.2'
|
4
4
|
|
5
|
-
def
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
5
|
+
def before_loop
|
6
|
+
super
|
7
|
+
@buffer = nil
|
8
|
+
config[:multi_line_prompt] ||= ' > '
|
9
|
+
end
|
10
|
+
|
11
|
+
def prompt
|
12
|
+
@buffer ? config[:multi_line_prompt] : super
|
13
|
+
end
|
14
|
+
|
15
|
+
def loop_once
|
16
|
+
catch(:multiline) do
|
17
|
+
super
|
18
|
+
@buffer = nil
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def print_eval_error(e)
|
23
|
+
if e.is_a?(SyntaxError) && e.message =~ /unexpected \$end|unterminated string meets end of file/
|
24
|
+
(@buffer ||= '') << @input+"\n"
|
25
|
+
throw :multiline
|
26
|
+
else
|
27
|
+
super
|
18
28
|
end
|
19
29
|
end
|
20
30
|
|
21
|
-
def
|
22
|
-
@
|
23
|
-
eval("_ = Ripl.shell.last_result", @binding)
|
24
|
-
rescue Exception => e
|
25
|
-
if e.is_a?(SyntaxError) && e.message =~ /unexpected \$end|unterminated string meets end of file/
|
26
|
-
throw :multiline, input + "\n"
|
27
|
-
else
|
28
|
-
@error_raised = true
|
29
|
-
print_eval_error(e)
|
30
|
-
end
|
31
|
-
ensure
|
32
|
-
@line += 1
|
31
|
+
def eval_input(input)
|
32
|
+
super(@buffer ? @buffer + input : input)
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ripl-multi_line
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jan Lelis
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-11-
|
18
|
+
date: 2010-11-12 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,12 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 21
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 2
|
33
|
-
-
|
34
|
-
version: 0.2.
|
33
|
+
- 1
|
34
|
+
version: 0.2.1
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
description: This ripl plugin allows you to evaluate multiple lines of Ruby code.
|