color_me_rad 0.0.2 → 0.0.3
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.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f30775f5a4680cd649e7fc3c2bc1504b4a88dd38432e52c96e50e4e849522959
|
4
|
+
data.tar.gz: c09e70fa9a859ca58848e8548bfb0d11524f6b97534cc8061867477614363ad0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 660d1550339e087225f83eca19ab68c4ad2ac73b7b91ecdb2452dd4168e79849c5a19b6027382d5889f791cfa718e96a2164bd6889252f39daa55aecf6eb785a
|
7
|
+
data.tar.gz: 8c71988f29a9b4c8296781aa1330e797f5d0b525c4b9d241e015ba35e9058462d23d6ba450e07f1931200d20cc548ae57c673be741ab452a97100803c7dc7436
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
ca2662805789ab17b6deee4f6af9b487
|
@@ -0,0 +1 @@
|
|
1
|
+
eb70724964427ecd99e9ef42be7e0de5f1334b922ce99613e8400905c585f513
|
@@ -0,0 +1 @@
|
|
1
|
+
46b2754dc744c0ef68acba3f8ab6efffc7796f117e2bb0405eda1e3ae32587c2c2bc1be53b358836341f49eb5d387df58835ba9c155744950a477e1f7018f188
|
data/color_me_rad.gemspec
CHANGED
@@ -35,7 +35,9 @@ module ColorMeRad
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def ruby_ivars(data)
|
38
|
-
|
38
|
+
method = data.is_a?(Module) ? :as_module : :as_object
|
39
|
+
|
40
|
+
send(method, data) do
|
39
41
|
map_ivars data
|
40
42
|
end
|
41
43
|
end
|
@@ -47,19 +49,37 @@ module ColorMeRad
|
|
47
49
|
end
|
48
50
|
|
49
51
|
def as_object(data, &block)
|
50
|
-
|
51
|
-
|
52
|
+
# this is the method ruby uses to 'encode' the object id shown by #to_s
|
53
|
+
# shift the bit (multiply by 2) and use the hex representation
|
54
|
+
id = (data.object_id << 1).to_s(16)
|
52
55
|
|
53
56
|
'%s%s%s%s %s%s' % [
|
54
|
-
|
55
|
-
key(
|
56
|
-
|
57
|
-
key(
|
57
|
+
syntax_constructs[:leader],
|
58
|
+
key(data.class.to_s, :constant),
|
59
|
+
syntax_constructs[:colon],
|
60
|
+
key("0x#{id}", 'Integer'),
|
61
|
+
yield,
|
62
|
+
syntax_constructs[:closer],
|
63
|
+
]
|
64
|
+
end
|
65
|
+
|
66
|
+
def as_module(data, &block)
|
67
|
+
'%s%s %s%s' % [
|
68
|
+
syntax_constructs[:leader],
|
69
|
+
key(data.to_s, :constant),
|
58
70
|
yield,
|
59
|
-
|
71
|
+
syntax_constructs[:closer],
|
60
72
|
]
|
61
73
|
end
|
62
74
|
|
75
|
+
def syntax_constructs
|
76
|
+
@syntax_constructs ||= {
|
77
|
+
:leader => key('#<', :syntax),
|
78
|
+
:closer => key('>', :syntax),
|
79
|
+
:colon => key(':', :syntax),
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
63
83
|
def colorize_data(data)
|
64
84
|
color ||= color_for_data_class(data)
|
65
85
|
data = data.inspect if [String].include?(data.class)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: color_me_rad
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Herrick
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -96,6 +96,9 @@ files:
|
|
96
96
|
- checksum/color_me_rad-0.0.1.gem.md5
|
97
97
|
- checksum/color_me_rad-0.0.1.gem.sha256
|
98
98
|
- checksum/color_me_rad-0.0.1.gem.sha512
|
99
|
+
- checksum/color_me_rad-0.0.2.gem.md5
|
100
|
+
- checksum/color_me_rad-0.0.2.gem.sha256
|
101
|
+
- checksum/color_me_rad-0.0.2.gem.sha512
|
99
102
|
- color_me_rad.gemspec
|
100
103
|
- lib/color_me_rad.rb
|
101
104
|
- lib/color_me_rad/color_helper.rb
|