ripl-multi_line 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require 'rubygems' unless Object.const_defined?(:Gem)
2
+ require 'rubygems' unless defined? Gem
3
3
  require File.dirname(__FILE__) + "/lib/ripl/multi_line"
4
4
 
5
5
  Gem::Specification.new do |s|
@@ -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.4'
14
+ s.add_dependency 'ripl', '>= 0.2.6'
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
@@ -1,3 +1,7 @@
1
+ == 0.2.0
2
+ * store buffer in an array instead of a string
3
+ * added ctrl+c to remove last line in multi-line situation
4
+
1
5
  == 0.1.4
2
6
  * be compatible with 0.2.4 (undo monkey patch)
3
7
 
data/README.rdoc CHANGED
@@ -16,4 +16,6 @@ You can customize your multi-line prompt with the <tt>:multi_line_prompt</tt> op
16
16
 
17
17
  Ripl.config[:multi_line_prompt] = ' >'
18
18
 
19
+ If you are in multi-line situation, you can press <tt>ctrl+c</tt> and the last line will be removed.
20
+
19
21
  J-_-L
@@ -2,7 +2,7 @@ require 'ripl'
2
2
 
3
3
  module Ripl
4
4
  module MultiLine
5
- VERSION = '0.1.4'
5
+ VERSION = '0.2.0'
6
6
 
7
7
  def before_loop
8
8
  super
@@ -22,15 +22,37 @@ module Ripl
22
22
 
23
23
  def print_eval_error(e)
24
24
  if e.is_a?(SyntaxError) && e.message =~ /unexpected \$end|unterminated string meets end of file/
25
- (@buffer ||= '') << @input+"\n"
25
+ @buffer ||= []
26
+ @buffer << @input
26
27
  throw :multiline
27
28
  else
28
29
  super
29
30
  end
30
31
  end
32
+
33
+ def loop_eval(input)
34
+ if @buffer
35
+ super @buffer*"\n" + "\n" + input
36
+ else
37
+ super input
38
+ end
39
+ end
31
40
 
32
- def eval_input(input)
33
- super(@buffer ? @buffer + input : input)
41
+ # remove last line from buffer
42
+ # TODO: nicer interface (rewriting?)
43
+ def handle_interrupt
44
+ if @buffer
45
+ @buffer.pop
46
+ if @buffer.empty?
47
+ @buffer = nil
48
+ return super
49
+ else
50
+ puts "[previous line removed]"
51
+ throw :multiline
52
+ end
53
+ else
54
+ super
55
+ end
34
56
  end
35
57
  end
36
58
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ripl-multi_line
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
- - 1
9
- - 4
10
- version: 0.1.4
7
+ - 2
8
+ - 0
9
+ version: 0.2.0
11
10
  platform: ruby
12
11
  authors:
13
12
  - Jan Lelis
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-11-18 00:00:00 +01:00
17
+ date: 2010-12-03 00:00:00 +01:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,12 +25,11 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 31
30
28
  segments:
31
29
  - 0
32
30
  - 2
33
- - 4
34
- version: 0.2.4
31
+ - 6
32
+ version: 0.2.6
35
33
  type: :runtime
36
34
  version_requirements: *id001
37
35
  description: This ripl plugin allows you to evaluate multiple lines of Ruby code.
@@ -65,7 +63,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
65
63
  requirements:
66
64
  - - ">="
67
65
  - !ruby/object:Gem::Version
68
- hash: 3
69
66
  segments:
70
67
  - 0
71
68
  version: "0"
@@ -74,7 +71,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
71
  requirements:
75
72
  - - ">="
76
73
  - !ruby/object:Gem::Version
77
- hash: 23
78
74
  segments:
79
75
  - 1
80
76
  - 3