fancy_irb 2.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 420f2bb457ec0eab47d8b118dc0579cc010060338406972fe53e9339411988ff
4
- data.tar.gz: 7a6adaf799dd94809ed4c8c998827983a2d7105a22b42449fc3f7ffdff6c2a05
3
+ metadata.gz: 89cbb2934ed19ad839cdc15eda21b617c01eb2bd6e689a54012c8eeee98098b9
4
+ data.tar.gz: dcded533d53ac26e54bce266d2a80eea702c38b22173735b014e50b163f258c8
5
5
  SHA512:
6
- metadata.gz: e61b4ad622dce35fccbfdb7f47beaa3aeed028d08aacbb051bb8d48b2a1140e1cc22686805fbab831968d09519947e0b9215686acc37fef495cb2d8ac8cc3b82
7
- data.tar.gz: 89a2464bb36c7385792f3cb7dc7e9a3336c81249c9f07b80060dbf9248abc85ad97a21d35a050679107dd53b0899d029796c650d979a328b037c33777d4ee279
6
+ metadata.gz: ba416ba54282e7172fcd88035163fa9f809d3465c2f85f3c7fd858456d41988de8df81ec709d26ee32ed254f78d0d4429765aa561edb5cde3cbb90ba5c5ded5a
7
+ data.tar.gz: 58d7c084efe90a61fc67857c497279ada9dd739ec732bf235e21a50171624ec2f103bdda48ef33ee31f91a995af9e0969459122910398a10329696575e7d5916
data/CHANGELOG.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 2.1.0
4
+ * Refactor IRB extension to accommodate IRB 1.8.2
5
+
3
6
  ## 2.0.0
4
7
  * Fix core functionality for newer IRB
5
8
  * Require Ruby 3.x / IRB 1.7+
@@ -1,22 +1,12 @@
1
- module IRB
2
- class Irb
1
+ module FancyIrb
2
+ module IrbExtCommon
3
3
  def output_value
4
4
  FancyIrb.output_value(@context, @scanner)
5
5
  end
6
6
 
7
- alias prompt_non_fancy prompt
8
- def prompt(prompt_arg, ltype, indent, line_no)
9
- FancyIrb.handle_prompt(
10
- prompt_non_fancy(prompt_arg, ltype, indent, line_no),
11
- IRB.conf[:AUTO_INDENT] ? indent * 2 : 0
12
- # IRB.conf[:AUTO_INDENT] && IRB.conf[:PROMPT][IRB.conf[:PROMPT_MODE]][:PROMPT_C] == prompt_arg
13
- )
14
- end
15
-
16
- alias signal_status_non_fancy signal_status
17
7
  def signal_status(name, *args, &block)
18
8
  FancyIrb.reset_line!
19
- signal_status_non_fancy(name, *args, &block)
9
+ super(name, *args, &block)
20
10
  ensure
21
11
  if name == :IN_EVAL
22
12
  FancyIrb.present_and_clear_captured_error!
@@ -24,14 +14,48 @@ module IRB
24
14
  end
25
15
  end
26
16
 
27
- class Context
28
- alias evaluate_non_fancy evaluate
17
+ module IrbExtPrompt
18
+ private def format_prompt(format, ltype, indent, line_no)
19
+ FancyIrb.handle_prompt(
20
+ super(format, ltype, indent, line_no),
21
+ IRB.conf[:AUTO_INDENT] ? indent * 2 : 0
22
+ # IRB.conf[:AUTO_INDENT] && IRB.conf[:PROMPT][IRB.conf[:PROMPT_MODE]][:PROMPT_C] == format
23
+ )
24
+ end
25
+ end
29
26
 
27
+ module IrbExtPromptLegacy
28
+ def prompt(format, ltype, indent, line_no)
29
+ FancyIrb.handle_prompt(
30
+ super(format, ltype, indent, line_no),
31
+ IRB.conf[:AUTO_INDENT] ? indent * 2 : 0
32
+ # IRB.conf[:AUTO_INDENT] && IRB.conf[:PROMPT][IRB.conf[:PROMPT_MODE]][:PROMPT_C] == format
33
+ )
34
+ end
35
+ end
36
+
37
+ module ContextExt
30
38
  def evaluate(*args, **kwargs)
31
- evaluate_non_fancy(*args, **kwargs)
39
+ super(*args, **kwargs)
32
40
  rescue Exception
33
41
  FancyIrb.register_error_capturer!
34
42
  raise
35
43
  end
36
44
  end
37
45
  end
46
+
47
+ module IRB
48
+ class Irb
49
+ prepend FancyIrb::IrbExtCommon
50
+
51
+ if IRB::VERSION < "1.8.2"
52
+ prepend FancyIrb::IrbExtPromptLegacy
53
+ else
54
+ prepend FancyIrb::IrbExtPrompt
55
+ end
56
+ end
57
+
58
+ class Context
59
+ prepend FancyIrb::ContextExt
60
+ end
61
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FancyIrb
4
- VERSION = '2.0.0'
4
+ VERSION = '2.1.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fancy_irb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Lelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-07 00:00:00.000000000 Z
11
+ date: 2023-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: paint
@@ -140,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
- rubygems_version: 3.4.4
143
+ rubygems_version: 3.4.21
144
144
  signing_key:
145
145
  specification_version: 4
146
146
  summary: Colors and rockets in IRB