scrawl 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/scrawl.rb +12 -10
- data/lib/scrawl/version.rb +1 -2
- data/spec/lib/scrawl/version_spec.rb +1 -1
- data/spec/lib/{scraw_spec.rb → scrawl_spec.rb} +10 -3
- metadata +14 -42
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffd77f15710ad1674e155f7a16fec2610cb2d393
|
4
|
+
data.tar.gz: 62604534ccf32894ddf1a722ec91a3c1c87f8aa3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f81c11cf64e206b82c166cab6741740e6051c3fb26d3392db2cc97e3e20007dac89e46229773a68f34a3541ac897ac49afff36c677d85371d08fc7ea66aae30
|
7
|
+
data.tar.gz: 07c6bce28351e8fd4f8c2fb6d73d6024ca5594a217e9613fd5c416c983cf270b27805a5195cfe540d806c00b385f84f12fa9d6254b6958ab2c6e77b74e6d9150
|
data/lib/scrawl.rb
CHANGED
@@ -1,6 +1,5 @@
|
|
1
1
|
require "forwardable"
|
2
2
|
|
3
|
-
# This is the main namespace for scrawl
|
4
3
|
class Scrawl
|
5
4
|
extend Forwardable
|
6
5
|
|
@@ -8,6 +7,8 @@ class Scrawl
|
|
8
7
|
PAIR_DELIMITER = " "
|
9
8
|
NAMESPACE_DELIMITER = "."
|
10
9
|
|
10
|
+
require_relative "scrawl/version"
|
11
|
+
|
11
12
|
attr_reader :tree
|
12
13
|
def_delegator :tree, :to_hash
|
13
14
|
def_delegator :tree, :to_h
|
@@ -30,20 +31,21 @@ class Scrawl
|
|
30
31
|
end.join(PAIR_DELIMITER)
|
31
32
|
end
|
32
33
|
|
33
|
-
|
34
|
+
def to_s(namespace = nil)
|
35
|
+
inspect(namespace)
|
36
|
+
end
|
34
37
|
|
35
|
-
def label(namespace, key)
|
38
|
+
private def label(namespace, key)
|
36
39
|
[namespace, key].compact.join(NAMESPACE_DELIMITER)
|
37
40
|
end
|
38
41
|
|
39
|
-
def element(value)
|
42
|
+
private def element(value)
|
40
43
|
case value
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
when Proc then value.call
|
45
|
+
when Numeric then value
|
46
|
+
when Symbol then value.to_s
|
47
|
+
when Regexp then value.to_s
|
48
|
+
else value
|
45
49
|
end.inspect
|
46
50
|
end
|
47
51
|
end
|
48
|
-
|
49
|
-
require_relative "scrawl/version"
|
data/lib/scrawl/version.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
|
3
|
-
describe Scrawl do
|
3
|
+
RSpec.describe Scrawl do
|
4
4
|
let(:input) { { a: 1 } }
|
5
5
|
let(:trees) { [input] }
|
6
6
|
let(:scrawl) { described_class.new(*trees) }
|
@@ -114,6 +114,13 @@ describe Scrawl do
|
|
114
114
|
expect(inspect).to include("\"example\"")
|
115
115
|
end
|
116
116
|
end
|
117
|
+
|
118
|
+
context "and a regexp value" do
|
119
|
+
let(:input) { { a: /foo(.+)/ } }
|
120
|
+
it "returns the escaped regexp" do
|
121
|
+
expect(inspect).to include(/foo(.+)/.to_s)
|
122
|
+
end
|
123
|
+
end
|
117
124
|
end
|
118
125
|
|
119
126
|
context "with multiple pairs" do
|
@@ -144,7 +151,7 @@ describe Scrawl do
|
|
144
151
|
end
|
145
152
|
end
|
146
153
|
|
147
|
-
describe "#tree"do
|
154
|
+
describe "#tree" do
|
148
155
|
let(:tree) { scrawl.tree }
|
149
156
|
|
150
157
|
it "returns the internal tree" do
|
@@ -160,7 +167,7 @@ describe Scrawl do
|
|
160
167
|
end
|
161
168
|
end
|
162
169
|
|
163
|
-
describe "#to_hash"do
|
170
|
+
describe "#to_hash" do
|
164
171
|
let(:to_hash) { scrawl.to_hash }
|
165
172
|
|
166
173
|
it "returns the internal tree" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scrawl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kurtis Rainbolt-Greene
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '3.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '3.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,34 +52,6 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.1'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: yard
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0.8'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0.8'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: kramdown
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - "~>"
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: '1.2'
|
76
|
-
type: :development
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - "~>"
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: '1.2'
|
83
55
|
- !ruby/object:Gem::Dependency
|
84
56
|
name: pry
|
85
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,33 +67,33 @@ dependencies:
|
|
95
67
|
- !ruby/object:Gem::Version
|
96
68
|
version: '0.9'
|
97
69
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
70
|
+
name: pry-doc
|
99
71
|
requirement: !ruby/object:Gem::Requirement
|
100
72
|
requirements:
|
101
73
|
- - "~>"
|
102
74
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
75
|
+
version: '0.6'
|
104
76
|
type: :development
|
105
77
|
prerelease: false
|
106
78
|
version_requirements: !ruby/object:Gem::Requirement
|
107
79
|
requirements:
|
108
80
|
- - "~>"
|
109
81
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0.
|
82
|
+
version: '0.6'
|
111
83
|
- !ruby/object:Gem::Dependency
|
112
|
-
name:
|
84
|
+
name: codeclimate-test-reporter
|
113
85
|
requirement: !ruby/object:Gem::Requirement
|
114
86
|
requirements:
|
115
87
|
- - "~>"
|
116
88
|
- !ruby/object:Gem::Version
|
117
|
-
version: '0.
|
89
|
+
version: '0.4'
|
118
90
|
type: :development
|
119
91
|
prerelease: false
|
120
92
|
version_requirements: !ruby/object:Gem::Requirement
|
121
93
|
requirements:
|
122
94
|
- - "~>"
|
123
95
|
- !ruby/object:Gem::Version
|
124
|
-
version: '0.
|
96
|
+
version: '0.4'
|
125
97
|
- !ruby/object:Gem::Dependency
|
126
98
|
name: benchmark-ips
|
127
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -159,10 +131,10 @@ extra_rdoc_files: []
|
|
159
131
|
files:
|
160
132
|
- lib/scrawl.rb
|
161
133
|
- lib/scrawl/version.rb
|
162
|
-
- spec/lib/scraw_spec.rb
|
163
134
|
- spec/lib/scrawl/version_spec.rb
|
135
|
+
- spec/lib/scrawl_spec.rb
|
164
136
|
- spec/spec_helper.rb
|
165
|
-
homepage: http://krainboltgreene.github.io/scrawl
|
137
|
+
homepage: http://krainboltgreene.github.io/scrawl.gem
|
166
138
|
licenses:
|
167
139
|
- MIT
|
168
140
|
metadata: {}
|
@@ -182,12 +154,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
182
154
|
version: '0'
|
183
155
|
requirements: []
|
184
156
|
rubyforge_project:
|
185
|
-
rubygems_version: 2.
|
157
|
+
rubygems_version: 2.4.8
|
186
158
|
signing_key:
|
187
159
|
specification_version: 4
|
188
160
|
summary: Turn hashes into simple log-ready output
|
189
161
|
test_files:
|
190
|
-
- spec/lib/scraw_spec.rb
|
191
162
|
- spec/lib/scrawl/version_spec.rb
|
163
|
+
- spec/lib/scrawl_spec.rb
|
192
164
|
- spec/spec_helper.rb
|
193
165
|
has_rdoc:
|