pry-pretty-numeric 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README +18 -0
- data/lib/pry-pretty-numeric.rb +2 -2
- data/lib/pry-pretty-numeric/version.rb +1 -1
- metadata +4 -3
data/README
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
pry-pretty-numeric
|
2
|
+
==================
|
3
|
+
|
4
|
+
This is a plugin for Pry.
|
5
|
+
Simply it makes Pry print numeric including '_' between each 3 digits like this.
|
6
|
+
|
7
|
+
pry(main)> 12345678
|
8
|
+
=> 12_345_678
|
9
|
+
|
10
|
+
pry(main)> 1234.5678
|
11
|
+
=> 1_234.567_8
|
12
|
+
|
13
|
+
USAGE
|
14
|
+
-----
|
15
|
+
|
16
|
+
gem install pry-pretty-numeric
|
17
|
+
|
18
|
+
% pry
|
data/lib/pry-pretty-numeric.rb
CHANGED
@@ -4,8 +4,8 @@ require "pp"
|
|
4
4
|
class Numeric
|
5
5
|
def pretty_inspect
|
6
6
|
integral, fractional = super.split('.', 2)
|
7
|
-
integral = integral.reverse.gsub(
|
8
|
-
fractional = fractional.gsub(
|
7
|
+
integral = integral.reverse.gsub(/\d{3}(?!$)/, '\&_').reverse
|
8
|
+
fractional = fractional.gsub(/\d{3}(?!$)/, '\&_') if fractional
|
9
9
|
[integral, fractional].compact.join('.')
|
10
10
|
end
|
11
11
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pry-pretty-numeric
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Genki Takiuchi
|
@@ -43,6 +43,7 @@ extra_rdoc_files: []
|
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
45
|
- Gemfile
|
46
|
+
- README
|
46
47
|
- Rakefile
|
47
48
|
- lib/pry-pretty-numeric.rb
|
48
49
|
- lib/pry-pretty-numeric/version.rb
|