rib 1.1.5 → 1.1.6

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
  SHA1:
3
- metadata.gz: 6a6d86b4e55eea04dd23d8266b12321528ec904a
4
- data.tar.gz: 54976f794a02b314f56804d825f73844ac244094
3
+ metadata.gz: 36e9907e98417b88befb05f1493f23737418dd34
4
+ data.tar.gz: a3b24ca77822b8f6aa5877a173303cde0b329127
5
5
  SHA512:
6
- metadata.gz: fd709b042a0e5217c6b0c0539e3be2fc84a8c60cf3e34fb26bc561e41757306fae9fc05dd58a90536d360bb2e4a67c99e0a011783305b1516975633fbca960f5
7
- data.tar.gz: d5e2de88b7978bdf29fd9bdb97de590a120e64bfe3f760f21a38829e1ebb953c357bb48ed02c60133d63bf31289602c1c1bd561ef96d4755a6fc11421005cc91
6
+ metadata.gz: 9bc4ead99bd2d24251849fabd4c03005fbd2ddb71dd704710dc6ebdbe22e867677c39ee665d18e27bae8f07b224bbcfee9fdb1b681a7121a17a90b3ca7692e59
7
+ data.tar.gz: 66c7f94e4549d4f63509ab8848f9227cd32660f31b98bc3ce380ff9b9431cbf6ea28c56b50a6fec9052fbf07f7f1643a161cc8a81d4ce97130fa69250e18fd16
data/CHANGES.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGES
2
2
 
3
+ ## Rib 1.1.6 -- 2013-08-14
4
+
5
+ * [more/color] Fixed inspecting recursive array and hash.
6
+
3
7
  ## Rib 1.1.5 -- 2013-07-11
4
8
 
5
9
  * Fixed `rib -h` with commands don't have a description.
@@ -40,14 +40,20 @@ module Rib::Color
40
40
  when Symbol ; send(colors[Symbol ]){ display }
41
41
 
42
42
  when Array ; send(colors[Array ]){ '[' } +
43
- result.map{ |e | format_color(e) }.
43
+ result.map{ |e | if e.object_id == result.object_id
44
+ send(colors[Array]){'[...]'}
45
+ else
46
+ format_color(e); end }.
44
47
  join(send(colors[Array ]){ ', ' }) +
45
48
  send(colors[Array ]){ ']' }
46
49
 
47
50
  when Hash ; send(colors[Hash ]){ '{' } +
48
51
  result.map{ |k, v| format_color(k) +
49
52
  send(colors[Hash ]){ '=>' } +
50
- format_color(v) }.
53
+ if v.object_id == result.object_id
54
+ send(colors[Hash]){'{...}'}
55
+ else
56
+ format_color(v); end }.
51
57
  join(send(colors[Hash ]){ ', ' }) +
52
58
  send(colors[Hash ]){ '}' }
53
59
 
data/lib/rib/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Rib
3
- VERSION = '1.1.5'
3
+ VERSION = '1.1.6'
4
4
  end
data/rib.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "rib"
5
- s.version = "1.1.5"
5
+ s.version = "1.1.6"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Lin Jen-Shin (godfat)"]
9
- s.date = "2013-07-11"
9
+ s.date = "2013-08-14"
10
10
  s.description = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell\n\nRib is based on the design of [ripl][] and the work of [ripl-rc][], some of\nthe features are also inspired by [pry][]. The aim of Rib is to be fully\nfeatured and yet very easy to opt-out or opt-in other features. It shall\nbe simple, lightweight and modular so that everyone could customize Rib.\n\n[ripl]: https://github.com/cldwalker/ripl\n[ripl-rc]: https://github.com/godfat/ripl-rc\n[pry]: https://github.com/pry/pry"
11
11
  s.email = ["godfat (XD) godfat.org"]
12
12
  s.executables = [
@@ -85,7 +85,7 @@ Gem::Specification.new do |s|
85
85
  s.homepage = "https://github.com/godfat/rib"
86
86
  s.licenses = ["Apache License 2.0"]
87
87
  s.require_paths = ["lib"]
88
- s.rubygems_version = "2.0.4"
88
+ s.rubygems_version = "2.0.6"
89
89
  s.summary = "Ruby-Interactive-ruBy -- Yet another interactive Ruby shell"
90
90
  s.test_files = [
91
91
  "test/core/test_completion.rb",
@@ -5,15 +5,15 @@ require 'rib/more/color'
5
5
  describe Rib::Color do
6
6
  behaves_like :rib
7
7
 
8
- should 'give correct color' do
9
- @color = Class.new do
10
- include Rib::Color
11
- def colors
12
- @colors ||= Rib::Shell.new.before_loop.config[:color]
13
- end
14
- end.new
8
+ color = Class.new do
9
+ include Rib::Color
10
+ def colors
11
+ @colors ||= Rib::Shell.new.before_loop.config[:color]
12
+ end
13
+ end.new
15
14
 
16
- @color.send(:format_color,
15
+ should 'give correct color' do
16
+ color.send(:format_color,
17
17
  [{0 => :a}, 'b', [nil, {false => Object}], {true => Exception.new}]).
18
18
  should.eq \
19
19
  "\e[34m[\e[0m\e[34m{\e[0m\e[31m0\e[0m\e[34m=>\e[0m\e[36m:a\e[0m\e" \
@@ -24,6 +24,17 @@ describe Rib::Color do
24
24
  "\e[0m\e[34m}\e[0m\e[34m]\e[0m"
25
25
  end
26
26
 
27
+ should 'inspect recursive array and hash just like built-in inspect' do
28
+ a = []
29
+ a << a
30
+ h = {}
31
+ h[0] = h
32
+ color.send(:format_color, [a, h]).should.eq \
33
+ "\e[34m[\e[0m\e[34m[\e[0m\e[34m[...]\e[0m\e[34m]\e[0m\e[34m, \e[0m" \
34
+ "\e[34m{\e[0m\e[31m0\e[0m\e[34m=>\e[0m\e[34m{...}\e[0m\e[34m}\e[0m" \
35
+ "\e[34m]\e[0m"
36
+ end
37
+
27
38
  # regression test
28
39
  should "colorize errors with `/' inside" do
29
40
  i = if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rib
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lin Jen-Shin (godfat)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-11 00:00:00.000000000 Z
11
+ date: 2013-08-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |-
14
14
  Ruby-Interactive-ruBy -- Yet another interactive Ruby shell
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  version: '0'
119
119
  requirements: []
120
120
  rubyforge_project:
121
- rubygems_version: 2.0.4
121
+ rubygems_version: 2.0.6
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Ruby-Interactive-ruBy -- Yet another interactive Ruby shell