ios_parser 0.4.0 → 0.4.1

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: 70ba90a49c66d3aeb9508337c1a018353bae30ba
4
- data.tar.gz: 326039e8f3eb1aa6dca37843799598cbc48db944
3
+ metadata.gz: 3fa46ea53424609c1cc2bd44edfcebd86cedec95
4
+ data.tar.gz: 632d1c06c880ca9d7ba17285c825ae4885fc4f08
5
5
  SHA512:
6
- metadata.gz: bab554233dcbadf4973c3d3b2221d401b5b4fe955eb54d1def89dd3b43da584af7638f7a3d6c984f9fb9a00471f7fa27a9e4423d59c62441d776180ce7180b25
7
- data.tar.gz: 076d66dd99628d7d5ada809147599243c065f346b8b0dbc4b25d34a4444bec01555c7583e4a299f536703d37a827a96340838cfbc9e57a274a28f51364322fb5
6
+ metadata.gz: 052fe0ba301f4c002237b35134f4a97d7bf0ac175fd3d7217ee6634e5bc685939a84e0ec7eb44ffa05950c95c27d687010e3998162814db1f01c7d108951ff81
7
+ data.tar.gz: c96e847e9af333cfa441588c57c1711c60323ae7d3cac08177a684fa26aa6d0fcd8da816926ffc815d64f50513f2d99c84676cb156eb11698a5cf7a7675c30db
@@ -49,7 +49,8 @@ module IOSParser
49
49
  alias any_child query_expression
50
50
  alias no_child query_expression
51
51
 
52
- def query_expression_hash(raw)
52
+ def query_expression_hash(original)
53
+ raw = original.dup
53
54
  raw.each_pair { |pred, arg| raw[pred] &&= send(pred, arg) }
54
55
  raw
55
56
  end
@@ -1,7 +1,7 @@
1
1
  module IOSParser
2
2
  class << self
3
3
  def version
4
- '0.4.0'
4
+ '0.4.1'
5
5
  end
6
6
  end
7
7
  end
@@ -17,12 +17,12 @@ END
17
17
 
18
18
  let(:expectation) { 'set dscp cs1' }
19
19
  let(:parsed) { IOSParser.parse(input) }
20
- subject { parsed.find(matcher).line }
20
+ subject { parsed.find(matcher.freeze).line }
21
21
 
22
22
  describe '#find' do
23
23
  context 'shortcut matcher' do
24
24
  describe String do
25
- let(:matcher) { 'set dscp cs1' }
25
+ let(:matcher) { 'set dscp cs1'.freeze }
26
26
  it { should == expectation }
27
27
  end
28
28
 
@@ -40,30 +40,32 @@ END
40
40
 
41
41
  context 'explicit matcher form of shortcut matcher' do
42
42
  describe String do
43
- let(:matcher) { { starts_with: 'set dscp cs1' } }
43
+ let(:matcher) { { starts_with: 'set dscp cs1'.freeze }.freeze }
44
44
  it { should == expectation }
45
45
  end
46
46
 
47
47
  describe Regexp do
48
- let(:matcher) { { line: /set .* cs1/ } }
48
+ let(:matcher) { { line: /set .* cs1/ }.freeze }
49
49
  it { should == expectation }
50
50
  end
51
51
 
52
52
  describe Proc do
53
53
  let(:expectation) { 'command_with_no_args' }
54
- let(:matcher) { { procedure: ->(c) { c.args.count == 1 } } }
54
+ let(:matcher) { { procedure: ->(c) { c.args.count == 1 } }.freeze }
55
55
  it { should == expectation }
56
56
  end
57
57
  end # context 'explicit matcher form of shortcut matcher' do
58
58
 
59
59
  context 'matcher: contains' do
60
60
  describe String do
61
- let(:matcher) { { contains: 'dscp cs1' } }
61
+ let(:matcher) { { contains: 'dscp cs1'.freeze }.freeze }
62
62
  it { should == expectation }
63
63
  end
64
64
 
65
65
  describe Array do
66
- let(:matcher) { { contains: %w(dscp cs1) } }
66
+ let(:matcher) {
67
+ { contains: ['dscp'.freeze, 'cs1'.freeze].freeze }.freeze
68
+ }
67
69
  it { should == expectation }
68
70
  end
69
71
  end # context 'matcher: contains' do
@@ -72,34 +74,36 @@ END
72
74
  let(:expectation) { 'class my_service' }
73
75
 
74
76
  describe String do
75
- let(:matcher) { { ends_with: 'my_service' } }
77
+ let(:matcher) { { ends_with: 'my_service'.freeze }.freeze }
76
78
  it { should == expectation }
77
79
  end
78
80
 
79
81
  describe Array do
80
- let(:matcher) { { ends_with: ['my_service'] } }
82
+ let(:matcher) { { ends_with: ['my_service'.freeze].freeze }.freeze }
81
83
  it { should == expectation }
82
84
  end
83
85
  end # context 'matcher: ends_with' do
84
86
 
85
87
  context 'matcher: all' do
86
- let(:matcher) { { all: ['set', /cs1/] } }
88
+ let(:matcher) { { all: ['set'.freeze, /cs1/].freeze }.freeze }
87
89
  it { should == expectation }
88
90
  end
89
91
 
90
92
  context 'matcher: parent' do
91
- let(:matcher) { { parent: /police 3/ } }
93
+ let(:matcher) { { parent: /police 3/ }.freeze }
92
94
  it { should == expectation }
93
95
  end
94
96
 
95
97
  context 'matcher: any' do
96
- let(:matcher) { { any: [/asdf/, /cs1/, /qwerwqe/] } }
98
+ let(:matcher) { { any: [/asdf/, /cs1/, /qwerwqe/].freeze }.freeze }
97
99
  it { should == expectation }
98
100
  end
99
101
 
100
102
  context 'matcher: any (with a hash)' do
101
103
  let(:matcher) do
102
- { any: { depth: 0, procedure: ->(c) { c.args.count == 1 } } }
104
+ {
105
+ any: { depth: 0, procedure: ->(c) { c.args.count == 1 } }.freeze
106
+ }.freeze
103
107
  end
104
108
 
105
109
  it do
@@ -109,13 +113,13 @@ END
109
113
  end
110
114
 
111
115
  context 'matcher: depth' do
112
- let(:matcher) { { depth: 3 } }
116
+ let(:matcher) { { depth: 3 }.freeze }
113
117
  it { should == expectation }
114
118
  end
115
119
 
116
120
  context 'matcher: none' do
117
121
  let(:matcher) do
118
- { none: [/policy/, /class/, /police/] }
122
+ { none: [/policy/, /class/, /police/].freeze }.freeze
119
123
  end
120
124
  it { should == expectation }
121
125
  end
@@ -127,8 +131,8 @@ END
127
131
  none: /policy/,
128
132
  not: /class/,
129
133
  not_all: /police/
130
- }
131
- }
134
+ }.freeze
135
+ }.freeze
132
136
  end
133
137
 
134
138
  it do
@@ -139,12 +143,12 @@ END
139
143
  end
140
144
 
141
145
  context 'matcher: any_child' do
142
- let(:matcher) { { not: { any_child: /dscp/ } } }
146
+ let(:matcher) { { not: { any_child: /dscp/ }.freeze }.freeze }
143
147
  it { should == expectation }
144
148
  end
145
149
 
146
150
  context 'matcher: no_child' do
147
- let(:matcher) { { no_child: /dscp/ } }
151
+ let(:matcher) { { no_child: /dscp/ }.freeze }
148
152
  it { should == expectation }
149
153
  end
150
154
  end # describe '#find' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ios_parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Miller
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-08 00:00:00.000000000 Z
11
+ date: 2016-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -120,3 +120,4 @@ test_files:
120
120
  - spec/lib/ios_parser/lexer_spec.rb
121
121
  - spec/lib/ios_parser_spec.rb
122
122
  - spec/spec_helper.rb
123
+ has_rdoc: