tracey 0.1.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.
Files changed (2) hide show
  1. data/lib/tracey.rb +31 -0
  2. metadata +62 -0
data/lib/tracey.rb ADDED
@@ -0,0 +1,31 @@
1
+ module Tracey
2
+
3
+ class << self
4
+ attr_accessor :format
5
+ end
6
+
7
+ def trace *stuff
8
+ puts trace_output(*stuff)
9
+ end
10
+
11
+ def trace! *stuff
12
+ raise trace_output(*stuff)
13
+ end
14
+
15
+ private
16
+
17
+ def trace_output *stuff
18
+ if stuff.first.is_a? Hash
19
+ stuff = stuff.first
20
+ else
21
+ stuff = stuff.inject({}) {|hash,ref| hash[ref] = eval(ref.to_s); hash }
22
+ end
23
+ stuff.inject("") {|output, pair| output + trace_format[*pair] }
24
+ end
25
+
26
+ def trace_format
27
+ Tracey.format || lambda {|label, object| "#{ label }: #{ object.inspect }\n\n" }
28
+ end
29
+ end
30
+
31
+ Object.send(:include, Tracey)
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: tracey
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - andyferra
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-03-11 00:00:00 -07:00
18
+ default_executable:
19
+ dependencies: []
20
+
21
+ description: Tracy does almost nothing, but it makes it makes the process of inspecting objects faster and easier on the eyes.
22
+ email: aferra@gmail.com
23
+ executables: []
24
+
25
+ extensions: []
26
+
27
+ extra_rdoc_files: []
28
+
29
+ files:
30
+ - lib/tracey.rb
31
+ has_rdoc: true
32
+ homepage: http://github.com/andyferra/tracey
33
+ licenses: []
34
+
35
+ post_install_message:
36
+ rdoc_options: []
37
+
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ segments:
52
+ - 0
53
+ version: "0"
54
+ requirements: []
55
+
56
+ rubyforge_project:
57
+ rubygems_version: 1.3.6
58
+ signing_key:
59
+ specification_version: 3
60
+ summary: Inspecting objects for lazy people.
61
+ test_files: []
62
+