ricecream 0.1.1 → 0.2.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: 2cff31eb924e068fa9e0778e5e23cbb17e80db8a91291467fa58e76e704204d9
4
- data.tar.gz: 5570dd392b71a4a12d73d7aea6f66218149cf256124a68a5787c14561607c481
3
+ metadata.gz: 5acee3b44937ed5be5788071563a4549958761667fc647cae7831b4683739a15
4
+ data.tar.gz: 4342369d05593a808844f35406baab827936daac1886863ac92ddecc23fd7688
5
5
  SHA512:
6
- metadata.gz: 8e75503929c08cddf078ce86e7e1ce7127649465a3bec31e7523d3573a106ee3b52c9b8448b19748be120c57afdbff6b01ded2ccd78440935239d4501863e8f2
7
- data.tar.gz: b200d30117c3b0bab06564e88ca9efc689596d89e35e6a8c435a1d17eda0ed36c5fba367074273712fc8fda63285218bcfaefd51eb229a16cce9c5ff4f372e04
6
+ metadata.gz: 4c27cbac678e8671b1debc89c040eab2bdd912f4c1f2d388d424b04981c02dbda17ee6b8b07371a4d66d7060aaa902290c787e09a0a802e2987ad148c570e8fd
7
+ data.tar.gz: 8138178d34cc00344f704ad4b2bed0ebe6738a15ae5085eb25afe86a3be5110b89b3a704a9badfa91a7ea5793b5be83780b40ab7f58fb4373dc313782c2d1493
data/README.md CHANGED
@@ -129,6 +129,16 @@ using Ricecream
129
129
  ic
130
130
  ```
131
131
 
132
+ Similarly, you can override `p` by `using Ricecream::P`.
133
+
134
+ ```ruby
135
+ require "ricecream/refine"
136
+
137
+ using Ricecream::P
138
+ foo = 123
139
+ p foo # => ic| foo: 123
140
+ ```
141
+
132
142
  ### Miscellaneous
133
143
 
134
144
  - `ic_format(*args)` is like `ic` but the output is returned as a string instead of written to stderr.
@@ -5,7 +5,7 @@ require_relative "ic_method"
5
5
 
6
6
  module Ricecream
7
7
  class Analyzer < Ripper
8
- MethodName = /\Aic(?:_format)?\z/
8
+ MethodName = /\A(?:ic|ic_format|p)\z/
9
9
 
10
10
  def initialize(path)
11
11
  @ic_methods = []
@@ -12,7 +12,14 @@ module Ricecream
12
12
  def ic_format(*args)
13
13
  Ricecream.format(caller_locations(1, 1).first, :ic_format, args)
14
14
  end
15
+ end
15
16
 
16
- private :ic, :ic_format
17
+ module P
18
+ refine Kernel do
19
+ def p(*args)
20
+ Ricecream.ic(caller_locations(1, 1).first, :p, args)
21
+ return *args
22
+ end
23
+ end
17
24
  end
18
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ricecream
4
- VERSION = "0.1.1"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ricecream
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - nodai2hITC
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-29 00:00:00.000000000 Z
11
+ date: 2021-01-30 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Never use puts/p to debug again! More useful debugging libraries than
14
14
  puts / p. (A Ruby port of Python's IceCream.)