ripl-multi_line 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemspec +1 -1
- data/CHANGELOG.rdoc +7 -0
- data/README.rdoc +8 -6
- data/lib/ripl/multi_line.rb +27 -10
- 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.3'
|
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/CHANGELOG.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -1,17 +1,19 @@
|
|
1
1
|
== Description
|
2
|
-
This {ripl}[http://github.com/
|
2
|
+
This {ripl}[http://github.com/cldwalker/ripl] plugin allows you to evaluate multiple lines of Ruby code.
|
3
3
|
|
4
4
|
== Install
|
5
|
-
Install the gem with
|
5
|
+
Install the gem with
|
6
6
|
|
7
|
-
|
7
|
+
sudo gem install ripl-multi_line
|
8
8
|
|
9
9
|
== Usage
|
10
10
|
|
11
|
-
Add to your
|
11
|
+
Add the following line to your <tt>~/.riplrc</tt>
|
12
12
|
|
13
|
-
|
13
|
+
require 'ripl/multi_line'
|
14
14
|
|
15
|
-
You can customize your multi-line prompt with the <tt
|
15
|
+
You can customize your multi-line prompt with the <tt>:multi_line_prompt</tt> option. For example, put this into your <tt>~/.riplrc</tt>:
|
16
|
+
|
17
|
+
Ripl.config[:multi_line_prompt] = ' >'
|
16
18
|
|
17
19
|
J-_-L
|
data/lib/ripl/multi_line.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
module Ripl
|
2
2
|
module MultiLine
|
3
|
-
VERSION = '0.1.
|
3
|
+
VERSION = '0.1.3'
|
4
4
|
|
5
5
|
def before_loop
|
6
6
|
super
|
7
7
|
@buffer = nil
|
8
|
-
config[:multi_line_prompt] ||= '
|
8
|
+
config[:multi_line_prompt] ||= '| '
|
9
9
|
end
|
10
10
|
|
11
11
|
def prompt
|
12
12
|
@buffer ? config[:multi_line_prompt] : super
|
13
13
|
end
|
14
14
|
|
15
|
-
def loop_once
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
end
|
15
|
+
#def loop_once
|
16
|
+
# catch(:multiline) do
|
17
|
+
# super
|
18
|
+
# @buffer = nil
|
19
|
+
# end
|
20
|
+
#end
|
21
21
|
|
22
22
|
def print_eval_error(e)
|
23
23
|
if e.is_a?(SyntaxError) && e.message =~ /unexpected \$end|unterminated string meets end of file/
|
@@ -28,10 +28,27 @@ module Ripl
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
#def eval_input(input)
|
32
|
+
# super(@buffer ? @buffer + input : input)
|
33
|
+
#end
|
34
|
+
end
|
35
|
+
|
36
|
+
# non-plugin api hack
|
37
|
+
class Shell
|
38
|
+
alias loop_once_without_multiline loop_once
|
39
|
+
def loop_once
|
40
|
+
catch(:multiline) do
|
41
|
+
loop_once_without_multiline
|
42
|
+
@buffer = nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
alias eval_input_without_multiline eval_input
|
31
47
|
def eval_input(input)
|
32
|
-
|
48
|
+
eval_input_without_multiline(@buffer ? @buffer + input : input)
|
33
49
|
end
|
34
|
-
end
|
50
|
+
end if defined? Ripl::Shell
|
51
|
+
|
35
52
|
end
|
36
53
|
|
37
54
|
Ripl::Shell.send :include, Ripl::MultiLine if defined? Ripl::Shell
|
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: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
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-17 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: 17
|
30
30
|
segments:
|
31
31
|
- 0
|
32
32
|
- 2
|
33
|
-
-
|
34
|
-
version: 0.2.
|
33
|
+
- 3
|
34
|
+
version: 0.2.3
|
35
35
|
type: :runtime
|
36
36
|
version_requirements: *id001
|
37
37
|
description: This ripl plugin allows you to evaluate multiple lines of Ruby code.
|