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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44d6787a4204535288716bd360ce9a91f8ab9e8e
4
- data.tar.gz: 4fe0bad5f4bd4222ee2f64b06cbaf18c088f6631
3
+ metadata.gz: ffd77f15710ad1674e155f7a16fec2610cb2d393
4
+ data.tar.gz: 62604534ccf32894ddf1a722ec91a3c1c87f8aa3
5
5
  SHA512:
6
- metadata.gz: 65eac765287fe7c6aae52ce9b8e87ccb06aefa10f4b058db046c5c435ba34521d47381d1e319da747c5c2310d98194d0abdcbcd4f984af1dc7936146d5381ff4
7
- data.tar.gz: 18d2f0e9e36cc7a62064a5b489e4a18f85c4941f3a45e93442826ff82bd0c76d62f3e6e8eacbe8506e94154706f8d01b2db34f11318305434b70da912d18aa8c
6
+ metadata.gz: 1f81c11cf64e206b82c166cab6741740e6051c3fb26d3392db2cc97e3e20007dac89e46229773a68f34a3541ac897ac49afff36c677d85371d08fc7ea66aae30
7
+ data.tar.gz: 07c6bce28351e8fd4f8c2fb6d73d6024ca5594a217e9613fd5c416c983cf270b27805a5195cfe540d806c00b385f84f12fa9d6254b6958ab2c6e77b74e6d9150
@@ -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
- private
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
- when Proc then value.call
42
- when Numeric then value
43
- when Symbol then value.to_s
44
- else value
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"
@@ -1,4 +1,3 @@
1
- # This is where we define the version number for the gem
2
1
  class Scrawl
3
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
4
3
  end
@@ -1,6 +1,6 @@
1
1
  require "spec_helper"
2
2
 
3
- describe Scrawl::VERSION do
3
+ RSpec.describe Scrawl::VERSION do
4
4
  it "should be a string" do
5
5
  expect(Scrawl::VERSION).to be_kind_of(String)
6
6
  end
@@ -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.0.0
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: 2014-04-13 00:00:00.000000000 Z
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: '2.14'
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: '2.14'
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: codeclimate-test-reporter
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.3'
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.3'
82
+ version: '0.6'
111
83
  - !ruby/object:Gem::Dependency
112
- name: rubocop
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.15'
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.15'
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.2.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: