wirb 2.1.2 → 2.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.
- checksums.yaml +5 -5
- data/CHANGELOG.md +3 -0
- data/COPYING.txt +1 -1
- data/README.md +32 -34
- data/Rakefile +1 -1
- data/lib/wirb/tokenizer.rb +3 -3
- data/lib/wirb/version.rb +3 -1
- data/spec/tokenizer_object_spec.rb +49 -22
- data/spec/tokenizer_time_spec.rb +7 -4
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 293a875ed373424e89b76a22b96723e1df4ba35e68a028f118e438502d59480e
|
4
|
+
data.tar.gz: debad98d10d276d8fcee37d7bcfa4f49e1a6479bce7f28dc6ab88c5ca0f6cbf7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bd7fceb6f837102d67e7979fb5f2dd2eb64b9c6bc538fed61891e634085e55fa0887a963cd149d3d55f892429889329fcc97f322c8d562b791a774f16b4c0928
|
7
|
+
data.tar.gz: dfa90dbb9e5b8a079d5a522e7ecc49ba52e89d02a469813198e97a569e62ce93d7a530531bf722a101292e67cc06e3ac299167277c00550a63fed13b4cae5619
|
data/CHANGELOG.md
CHANGED
data/COPYING.txt
CHANGED
data/README.md
CHANGED
@@ -1,23 +1,23 @@
|
|
1
|
-
## WIRB Interactive Ruby [](
|
1
|
+
## WIRB Interactive Ruby [](https://badge.fury.io/rb/wirb) [<img src="https://travis-ci.org/janlelis/wirb.png" />](https://travis-ci.org/janlelis/wirb)
|
2
2
|
|
3
|
-
**WIRB** syntax highlights Ruby objects.
|
3
|
+
The **WIRB** gem syntax highlights Ruby objects. Works best as your default REPL inspector (see usage section below), but does not require IRB.
|
4
4
|
|
5
|
-
Supported Rubies: 2.
|
5
|
+
Supported Rubies: 2.7, 2.6, 2.5, 2.4
|
6
6
|
|
7
|
-
|
7
|
+
Older Rubies, should work: 2.3, 2.2, 2.1, 2.0, rubinius
|
8
8
|
|
9
|
-
[
|
9
|
+
Ancient Rubies (1.9, 1.8): Please use [WIRB 1.0](https://github.com/janlelis/wirb/tree/1.0.3)
|
10
|
+
|
11
|
+
[See it in action](https://travis-ci.org/janlelis/wirb/jobs/56299603)
|
10
12
|
|
11
13
|
|
12
14
|
## Features
|
13
15
|
|
14
|
-
* Syntax highlighting for Ruby objects
|
16
|
+
* Syntax highlighting for inspected Ruby objects
|
15
17
|
* No monkey patches anywhere
|
16
|
-
* Support for generic objects, especially enumerators, and nested generic
|
17
|
-
|
18
|
-
*
|
19
|
-
* Supports stdlib objects, like `Set`
|
20
|
-
* Custom color schemas via YAML
|
18
|
+
* Support for generic objects, especially enumerators, and nested generic objects
|
19
|
+
* Supports common standard library objects, like `Set`
|
20
|
+
* Color schemas customizable via YAML
|
21
21
|
|
22
22
|
## Install
|
23
23
|
|
@@ -25,56 +25,54 @@ Install the gem with:
|
|
25
25
|
|
26
26
|
$ gem install wirb
|
27
27
|
|
28
|
+
Or add it to your Gemfile:
|
29
|
+
|
30
|
+
gem 'wirb'
|
31
|
+
|
28
32
|
## Usage
|
29
33
|
|
30
34
|
To start IRB with WIRB activated for one session, do:
|
31
35
|
|
32
36
|
$ irb -r wirb --inspect wirb
|
33
37
|
|
34
|
-
To activate WIRB permanently, you
|
38
|
+
To activate WIRB permanently, you can add this to the `~/.irbrc` file:
|
35
39
|
|
36
40
|
require 'wirb'
|
37
41
|
Wirb.start
|
38
42
|
|
43
|
+
Another way would be to use [Irbtools](https://irb.tools), which activate WIRB automatically.
|
44
|
+
|
45
|
+
## `Kernel#wp`
|
46
|
+
|
47
|
+
WIRB comes with a pretty printing utility (similar to awesome_print):
|
48
|
+
|
49
|
+
require 'wirb/wp'
|
50
|
+
wp some_object
|
51
|
+
|
39
52
|
### Bundled Schemas
|
40
53
|
|
41
|
-
These are the bundled color schemas. You can load one with `Wirb.load_schema
|
42
|
-
:name`
|
54
|
+
These are the bundled color schemas. You can load one with `Wirb.load_schema(:name)`
|
43
55
|
|
44
56
|
* `:classic` (default)
|
45
57
|
* `:colorless` (only uses :bright, :underline and :inverse effect)
|
46
|
-
* `:ultra` (matches the colorscheme from
|
47
|
-
[Ultra](https://github.com/venantius/ultra) over in Clojure-land)
|
58
|
+
* `:ultra` (by @venantius, matches the colorscheme from [Ultra](https://github.com/venantius/ultra) over in Clojure-land)
|
48
59
|
|
49
60
|
### Usage with Rails
|
50
61
|
|
51
|
-
|
52
|
-
|
53
|
-
## `Kernel#wp`
|
54
|
-
|
55
|
-
You can use WIRB like awesome_print to highlight any objects using `wp`:
|
56
|
-
|
57
|
-
require 'wirb/wp'
|
58
|
-
wp some_object
|
62
|
+
If you run into problems using WIRB with Rails, try [the solution in this issue](https://github.com/janlelis/wirb/issues/12#issuecomment-249492524).
|
59
63
|
|
60
64
|
## Also See
|
61
65
|
|
62
66
|
* Gem that allows you to configure views for specific objects:
|
63
67
|
[hirb](https://github.com/cldwalker/hirb)
|
64
|
-
* WIRB is part of: [
|
65
|
-
* RIPL is an IRB alternative, syntax highlighting plugin (uses wirb by
|
66
|
-
default):
|
67
|
-
[ripl-color_result](https://github.com/janlelis/ripl-color_result)
|
68
|
+
* WIRB is part of: [Irbtools](https://github.com/janlelis/irbtools)
|
68
69
|
* More about terminal colors: [Paint](https://github.com/janlelis/paint)
|
69
|
-
* [Wirble](https://rubygems.org/gems/wirble): WIRB's predecessor
|
70
|
-
|
71
70
|
|
72
71
|
## Credits
|
73
72
|
|
74
|
-
Copyright (c) 2011-
|
75
|
-
details.
|
73
|
+
Copyright (c) 2011-2019 Jan Lelis <https://janlelis.com> see COPYING for details.
|
76
74
|
|
77
|
-
|
78
|
-
<pabs@pablotron.org>
|
75
|
+
First tokenizer version was based on the [wirble](https://rubygems.org/gems/wirble) gem:
|
76
|
+
Copyright (C) 2006-2009 Paul Duncan <pabs@pablotron.org>
|
79
77
|
|
80
78
|
[All contributors](https://github.com/janlelis/wirb/contributors)
|
data/Rakefile
CHANGED
@@ -24,7 +24,7 @@ end
|
|
24
24
|
|
25
25
|
desc "Install the gem locally"
|
26
26
|
task :install => :gem do
|
27
|
-
sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}.gem --no-
|
27
|
+
sh %{gem install pkg/#{gemspec.name}-#{gemspec.version}.gem --no-doc}
|
28
28
|
end
|
29
29
|
|
30
30
|
desc "Generate the gemspec"
|
data/lib/wirb/tokenizer.rb
CHANGED
@@ -239,7 +239,7 @@ module Wirb
|
|
239
239
|
when :time # via regex, state needs to be triggered somewhere else
|
240
240
|
peek = chars[i..-1].join
|
241
241
|
if [
|
242
|
-
/^\d+-\d{2}-\d{2} \d{2}:\d{2}:\d{2} (?:[+-]\d{4}|[a-z]{3})/i,
|
242
|
+
/^\d+-\d{2}-\d{2} \d{2}:\d{2}:\d{2}(?:\.\d{9})? (?:[+-]\d{4}|[a-z]{3})/i,
|
243
243
|
].any?{ |regex|
|
244
244
|
( @token + peek ) =~ regex
|
245
245
|
} # found, adjust parsing-pointer:
|
@@ -400,10 +400,10 @@ module Wirb
|
|
400
400
|
if c =~ /[x0-9a-f]/
|
401
401
|
@token << c
|
402
402
|
else
|
403
|
-
if c == '@'
|
403
|
+
if c == '@' || c == ' ' && nc != "@"
|
404
404
|
pass_state[:remove]
|
405
405
|
push_state[:object_line]
|
406
|
-
pass[:object_line_prefix,
|
406
|
+
pass[:object_line_prefix, c]
|
407
407
|
else
|
408
408
|
pass_state[:remove, :repeat]
|
409
409
|
end
|
data/lib/wirb/version.rb
CHANGED
@@ -11,33 +11,60 @@ describe tokenizer(__FILE__) do
|
|
11
11
|
[:object_address, OBJECT_ID],
|
12
12
|
[:close_object, ">"],
|
13
13
|
]
|
14
|
-
|
14
|
+
end
|
15
15
|
|
16
16
|
please do check proc{}
|
17
|
-
|
18
|
-
[
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
17
|
+
if RUBY_VERSION >= "2.7"
|
18
|
+
tokens.should be_like [
|
19
|
+
[:open_object, "#<"],
|
20
|
+
[:object_class, "Proc"],
|
21
|
+
[:object_description_prefix, ":"],
|
22
|
+
[:object_address, OBJECT_ID],
|
23
|
+
[:object_line_prefix, " "], # changed in 2.7
|
24
|
+
[:object_line, /.*tokenizer_object_spec.rb:/],
|
25
|
+
[:object_line_number, /\d+/],
|
26
|
+
[:close_object, ">"],
|
27
|
+
]
|
28
|
+
else
|
29
|
+
tokens.should be_like [
|
30
|
+
[:open_object, "#<"],
|
31
|
+
[:object_class, "Proc"],
|
32
|
+
[:object_description_prefix, ":"],
|
33
|
+
[:object_address, OBJECT_ID],
|
34
|
+
[:object_line_prefix, "@"],
|
35
|
+
[:object_line, /.*tokenizer_object_spec.rb:/],
|
36
|
+
[:object_line_number, /\d+/],
|
37
|
+
[:close_object, ">"],
|
38
|
+
]
|
39
|
+
end
|
27
40
|
end
|
28
41
|
|
29
42
|
please do check lambda{}
|
30
|
-
|
31
|
-
[
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
43
|
+
if RUBY_VERSION >= "2.7"
|
44
|
+
tokens.should be_like [
|
45
|
+
[:open_object, "#<"],
|
46
|
+
[:object_class, "Proc"],
|
47
|
+
[:object_description_prefix, ":"],
|
48
|
+
[:object_address, OBJECT_ID],
|
49
|
+
[:object_line_prefix, " "], # changed in 2.7
|
50
|
+
[:object_line, /.*tokenizer_object_spec.rb:/],
|
51
|
+
[:object_line_number, /\d+/],
|
52
|
+
[:object_description, " (lambda)"],
|
53
|
+
[:close_object, ">"],
|
54
|
+
]
|
55
|
+
else
|
56
|
+
tokens.should be_like [
|
57
|
+
[:open_object, "#<"],
|
58
|
+
[:object_class, "Proc"],
|
59
|
+
[:object_description_prefix, ":"],
|
60
|
+
[:object_address, OBJECT_ID],
|
61
|
+
[:object_line_prefix, "@"],
|
62
|
+
[:object_line, /.*tokenizer_object_spec.rb:/],
|
63
|
+
[:object_line_number, /\d+/],
|
64
|
+
[:object_description, " (lambda)"],
|
65
|
+
[:close_object, ">"],
|
66
|
+
]
|
67
|
+
end
|
41
68
|
end
|
42
69
|
|
43
70
|
please do check StringScanner.new('wirb')
|
data/spec/tokenizer_time_spec.rb
CHANGED
@@ -1,14 +1,17 @@
|
|
1
1
|
describe tokenizer(__FILE__) do
|
2
2
|
after :each do check_value end
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
|
5
|
+
please do
|
6
|
+
now = Time.now
|
7
|
+
now2 = Time.now
|
8
|
+
check [now, now2]
|
6
9
|
tokens.should == [
|
7
10
|
[:open_array, "["],
|
8
|
-
[:time, now.
|
11
|
+
[:time, now.inspect],
|
9
12
|
[:comma, ","],
|
10
13
|
[:whitespace, " "],
|
11
|
-
[:time,
|
14
|
+
[:time, now2.inspect],
|
12
15
|
[:close_array, "]"],
|
13
16
|
]
|
14
17
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wirb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.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:
|
11
|
+
date: 2019-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: paint
|
@@ -133,8 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
|
-
|
137
|
-
rubygems_version: 2.6.13
|
136
|
+
rubygems_version: 3.0.6
|
138
137
|
signing_key:
|
139
138
|
specification_version: 4
|
140
139
|
summary: WIRB Interactive Ruby
|