scrawl 1.1.0 → 2.0.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: ffd77f15710ad1674e155f7a16fec2610cb2d393
4
- data.tar.gz: 62604534ccf32894ddf1a722ec91a3c1c87f8aa3
3
+ metadata.gz: 51f49457e302b9c0332607ec11823a28e2e79c2a
4
+ data.tar.gz: 24c3bbfe67bf1735272b29794b03cd0362e13831
5
5
  SHA512:
6
- metadata.gz: 1f81c11cf64e206b82c166cab6741740e6051c3fb26d3392db2cc97e3e20007dac89e46229773a68f34a3541ac897ac49afff36c677d85371d08fc7ea66aae30
7
- data.tar.gz: 07c6bce28351e8fd4f8c2fb6d73d6024ca5594a217e9613fd5c416c983cf270b27805a5195cfe540d806c00b385f84f12fa9d6254b6958ab2c6e77b74e6d9150
6
+ metadata.gz: 6e0f7c6228413eee997cd4eddf79657d1e440e1bc54a7532feb35515c1795a6ed20ed4eef23def92059ee0479cee5ae1e2dae48564394f71ea3e458006818786
7
+ data.tar.gz: a398998d1a96fb411b9798eddf5872dec657ca7cc962a3ffb8a9e530fc7493630ab3ec4fa412e95afce31347dca4eee2332eaf9e06ec335ed608850a34c550cf
data/lib/scrawl.rb CHANGED
@@ -1,8 +1,4 @@
1
- require "forwardable"
2
-
3
1
  class Scrawl
4
- extend Forwardable
5
-
6
2
  KEY_VALUE_DELIMITER = "="
7
3
  PAIR_DELIMITER = " "
8
4
  NAMESPACE_DELIMITER = "."
@@ -10,8 +6,6 @@ class Scrawl
10
6
  require_relative "scrawl/version"
11
7
 
12
8
  attr_reader :tree
13
- def_delegator :tree, :to_hash
14
- def_delegator :tree, :to_h
15
9
 
16
10
  def initialize(*trees)
17
11
  @tree = trees.inject({}) { |global, tree| global.merge(tree) }
@@ -24,7 +18,7 @@ class Scrawl
24
18
  def inspect(namespace = nil)
25
19
  @tree.map do |key, value|
26
20
  unless value.respond_to?(:to_hash)
27
- "#{label(namespace, key)}#{KEY_VALUE_DELIMITER}#{element(value)}"
21
+ label(namespace, key) + KEY_VALUE_DELIMITER + element(value)
28
22
  else
29
23
  Scrawl.new(value).inspect(key)
30
24
  end
@@ -35,17 +29,23 @@ class Scrawl
35
29
  inspect(namespace)
36
30
  end
37
31
 
32
+ def to_hash
33
+ tree.to_hash
34
+ end
35
+
36
+ def to_h
37
+ tree.to_h
38
+ end
39
+
38
40
  private def label(namespace, key)
39
41
  [namespace, key].compact.join(NAMESPACE_DELIMITER)
40
42
  end
41
43
 
42
44
  private def element(value)
43
45
  case 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
49
- end.inspect
46
+ when Proc then element(value.call)
47
+ when Symbol then element(value.to_s)
48
+ else value.inspect
49
+ end
50
50
  end
51
51
  end
@@ -1,3 +1,3 @@
1
1
  class Scrawl
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
@@ -118,7 +118,7 @@ RSpec.describe Scrawl do
118
118
  context "and a regexp value" do
119
119
  let(:input) { { a: /foo(.+)/ } }
120
120
  it "returns the escaped regexp" do
121
- expect(inspect).to include(/foo(.+)/.to_s)
121
+ expect(inspect).to include("/foo(.+)/")
122
122
  end
123
123
  end
124
124
  end
data/spec/spec_helper.rb CHANGED
@@ -1,6 +1,26 @@
1
1
  require "codeclimate-test-reporter"
2
- CodeClimate::TestReporter.start
3
-
4
2
  require "pry"
5
3
  require "rspec"
6
4
  require "scrawl"
5
+
6
+ RSpec.configure do |let|
7
+ let.before("suite") do
8
+ CodeClimate::TestReporter.start
9
+ end
10
+
11
+ # Exit the spec after the first failure
12
+ let.fail_fast = true
13
+
14
+ # Only run a specific file, using the ENV variable
15
+ # Example: FILE=spec/blankgem/version_spec.rb bundle exec rake spec
16
+ let.pattern = ENV["FILE"]
17
+
18
+ # Show the slowest examples in the suite
19
+ let.profile_examples = true
20
+
21
+ # Colorize the output
22
+ let.color = true
23
+
24
+ # Output as a document string
25
+ let.default_formatter = "doc"
26
+ end
metadata CHANGED
@@ -1,127 +1,127 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrawl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.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: 2015-08-08 00:00:00.000000000 Z
11
+ date: 2015-08-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: 1.10.5
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: 1.10.5
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '3.0'
33
+ version: 3.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: '3.0'
40
+ version: 3.3.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '10.1'
47
+ version: 10.4.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '10.1'
54
+ version: 10.4.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: pry
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '0.9'
61
+ version: 0.10.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '0.9'
68
+ version: 0.10.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: pry-doc
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '0.6'
75
+ version: 0.8.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '0.6'
82
+ version: 0.8.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: codeclimate-test-reporter
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '0.4'
89
+ version: 0.4.7
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: '0.4'
96
+ version: 0.4.7
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: benchmark-ips
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - "~>"
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: '1.2'
103
+ version: 2.3.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - "~>"
108
+ - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: '1.2'
110
+ version: 2.3.0
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: ruby-prof
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - "~>"
115
+ - - '='
116
116
  - !ruby/object:Gem::Version
117
- version: '0.14'
117
+ version: 0.15.8
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - "~>"
122
+ - - '='
123
123
  - !ruby/object:Gem::Version
124
- version: '0.14'
124
+ version: 0.15.8
125
125
  description: Turn hashes into simple log-ready output
126
126
  email:
127
127
  - me@kurtisrainboltgreene.name