tracer 0.2.0 → 0.2.1

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: f040d7e0181c8be3aa0d41e5be786aca6d3632c1367b6180a3cfc2b19bda57bf
4
- data.tar.gz: 43143d936ab079338c0039718c021f6c9d50d8ac93ba5a1a90320eeed466eaf1
3
+ metadata.gz: 13d3b55fac8c903711f78ccb14e872f8c312dde28dda5ed7f5fa664d04dd2a3b
4
+ data.tar.gz: 71c21f53b34f98870d4e6b49c84432867375c24f56c3d3a4ebd47e4d6bdaeef5
5
5
  SHA512:
6
- metadata.gz: 51e73efd3fc7eea7b783f797f6afa67b1d7cee068383e36e076046a17462d1a7f36b58b85150bcbb700f0b7c24214b5893039241bfc16c27cc72f9fea4e6665b
7
- data.tar.gz: 8cb8b671a2e630a0f03b1485f858320ccd7bcb260a06c41dbb373342774377c6911335d78e50f7f473b4722df24f070e8409c02c9ce3223455c001aaff08a8e8
6
+ metadata.gz: 54cb3be80359764539089df166a7ad922dea9ebea0cb8450a815f1956fbd780c3d6ed31bd5ea8e01cbf24689131c6463a5edb156220313b0c12e024f54d99565
7
+ data.tar.gz: 683343e41cb7150fdd256c4427a4ca9971a87b592093721e5d3f00a40141136eeaf884a9242e7b20f46a0e47f35f445eede9c2b612731f12a38f5f1c20ad6c3a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tracer (0.2.0)
4
+ tracer (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/tracer/irb.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require_relative "../tracer"
1
2
  require "irb/cmd/nop"
2
3
  require "irb"
3
4
 
@@ -46,6 +47,11 @@ module IRB
46
47
  description "Trace the target object (or self) in the given expression. Usage: `trace [target,] <expression>`"
47
48
 
48
49
  def execute(*args)
50
+ if args.empty?
51
+ puts "Please provide the expression to trace. Usage: `trace [target,] <expression>`"
52
+ return
53
+ end
54
+
49
55
  args = args.first.split(/,/, 2)
50
56
 
51
57
  case args.size
@@ -56,8 +62,13 @@ module IRB
56
62
  target = eval(args.first, irb_context.workspace.binding)
57
63
  expression = args.last
58
64
  else
59
- raise ArgumentError,
60
- "wrong number of arguments (given #{args.size}, expected 1..2)"
65
+ puts "Please provide the expression to trace. Usage: `trace [target,] <expression>`"
66
+ return
67
+ end
68
+
69
+ unless expression
70
+ puts "Please provide the expression to trace. Usage: `trace [target,] <expression>`"
71
+ return
61
72
  end
62
73
 
63
74
  b = irb_context.workspace.binding
@@ -69,7 +80,14 @@ module IRB
69
80
  category "Tracing"
70
81
  description "Trace method calls in the given expression. Usage: `trace_call <expression>`"
71
82
 
72
- def execute(expression)
83
+ def execute(*args)
84
+ expression = args.first
85
+
86
+ unless expression
87
+ puts "Please provide the expression to trace. Usage: `trace_call <expression>`"
88
+ return
89
+ end
90
+
73
91
  b = irb_context.workspace.binding
74
92
  Tracer.trace_call { eval(expression, b) }
75
93
  end
@@ -79,7 +97,14 @@ module IRB
79
97
  category "Tracing"
80
98
  description "Trace exceptions in the given expression. Usage: `trace_exception <expression>`"
81
99
 
82
- def execute(expression)
100
+ def execute(*args)
101
+ expression = args.first
102
+
103
+ unless expression
104
+ puts "Please provide the expression to trace. Usage: `trace_exception <expression>`"
105
+ return
106
+ end
107
+
83
108
  b = irb_context.workspace.binding
84
109
  Tracer.trace_exception { eval(expression, b) }
85
110
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tracer
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.1"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stan Lo