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 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
@@ -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(/.{3}(?!$)/, '\&_').reverse
8
- fractional = fractional.gsub(/.{3}/, '\&_') if fractional
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
@@ -1,5 +1,5 @@
1
1
  class Pry
2
2
  module PrettyNumeric
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
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