hotdog 0.24.0 → 0.25.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: 8498a1d399ef913b9d29a76bb4dcd3b934383d3a
4
- data.tar.gz: 306372f50dbf1bb056f4668dab2e4877a10b5023
3
+ metadata.gz: a6cb5a21b306e4a1d4ba2ed3f56a32bccede9d3e
4
+ data.tar.gz: db352cb8caf7b6204b5af04cae89ade3bb3225a3
5
5
  SHA512:
6
- metadata.gz: 77f1c40c00c9ac3d1893eeeee77cf4be3b1ce7d10713a2336cf8a74a6a62e3823f4bebacec432737533984971bf279a1dea15f1f3be6c0c7ff13ddce7d496c16
7
- data.tar.gz: 57f0780c11d1d3e2822f68adee9918ea630b153b9f1d33ad56bb6350323f92e9779fafbe69ddc93a25f1bd5d028a8b6d65e15b124a2083fd6ff4aa746a191237
6
+ metadata.gz: 2f34769acd4326c2d965fee9e69587af995d1764e00318531e8d36fab9020f520aaa4cb57d5950a95938a895ac3359a4800cdae089673c59f5c280f1d16a4611
7
+ data.tar.gz: cbcafc9311ea4f8384f57065324c104d0948bc8f95ad0e5108a4479d319e603e2501a8cc25b89c00057fbdd0777585b6b5621e43ed1695b07091e6faa27dc1b5
@@ -89,8 +89,8 @@ module Hotdog
89
89
  else
90
90
  if 0 < tags.length
91
91
  fields = tags.map { |tag|
92
- tag_name, _tag_value = split_tag(tag)
93
- tag_name
92
+ tagname, _tagvalue = split_tag(tag)
93
+ tagname
94
94
  }
95
95
  get_hosts_fields(host_ids, fields)
96
96
  else
@@ -99,7 +99,7 @@ module Hotdog
99
99
  fields = [
100
100
  @options[:primary_tag],
101
101
  "host",
102
- ] + get_fields(host_ids).reject { |tag_name| tag_name == @options[:primary_tag] }
102
+ ] + get_fields(host_ids).reject { |tagname| tagname == @options[:primary_tag] }
103
103
  get_hosts_fields(host_ids, fields)
104
104
  else
105
105
  fields = [
@@ -152,9 +152,9 @@ module Hotdog
152
152
  end
153
153
  end
154
154
 
155
- result = fields.map { |tag_name|
156
- tag_value = field_values.fetch(tag_name.downcase, nil)
157
- display_tag(tag_name, tag_value)
155
+ result = fields.map { |tagname|
156
+ tagvalue = field_values.fetch(tagname.downcase, nil)
157
+ display_tag(tagname, tagvalue)
158
158
  }
159
159
  [result, fields]
160
160
  end
@@ -171,8 +171,8 @@ module Hotdog
171
171
  "INNER JOIN tags ON hosts_tags.tag_id = tags.id " \
172
172
  "WHERE hosts_tags.host_id IN (%s) AND tags.name = ? " \
173
173
  "GROUP BY hosts_tags.host_id, tags.name ORDER BY hosts_tags.host_id;" % host_ids.map { "?" }.join(", ")
174
- r = execute(q, host_ids + [field]).map { |tag_name, tag_value|
175
- [display_tag(tag_name, tag_value)]
174
+ r = execute(q, host_ids + [field]).map { |tagname, tagvalue|
175
+ [display_tag(tagname, tagvalue)]
176
176
  }
177
177
  if r.empty?
178
178
  host_ids.map { [nil] }
@@ -184,12 +184,12 @@ module Hotdog
184
184
  [result, [field]]
185
185
  end
186
186
 
187
- def display_tag(tag_name, tag_value)
188
- if tag_value
189
- if tag_value.empty?
190
- tag_name # use `tag_name` as `tag_value` for the tags without any values
187
+ def display_tag(tagname, tagvalue)
188
+ if tagvalue
189
+ if tagvalue.empty?
190
+ tagname # use `tagname` as `tagvalue` for the tags without any values
191
191
  else
192
- tag_value
192
+ tagvalue
193
193
  end
194
194
  else
195
195
  nil
@@ -398,15 +398,15 @@ module Hotdog
398
398
  end
399
399
 
400
400
  def split_tag(tag)
401
- tag_name, tag_value = tag.split(":", 2)
402
- [tag_name, tag_value || ""]
401
+ tagname, tagvalue = tag.split(":", 2)
402
+ [tagname, tagvalue || ""]
403
403
  end
404
404
 
405
- def join_tag(tag_name, tag_value)
406
- if tag_value.to_s.empty?
407
- tag_name
405
+ def join_tag(tagname, tagvalue)
406
+ if tagvalue.to_s.empty?
407
+ tagname
408
408
  else
409
- "#{tag_name}:#{tag_value}"
409
+ "#{tagname}:#{tagvalue}"
410
410
  end
411
411
  end
412
412
 
@@ -66,16 +66,16 @@ module Hotdog
66
66
  case
67
67
  when n[:left] && n[:right] then drilldown.(n[:left]) + drilldown.(n[:right])
68
68
  when n[:expression] then drilldown.(n[:expression])
69
- when n[:tag_name] then [n[:tag_name]]
69
+ when n[:tagname] then [n[:tagname]]
70
70
  else []
71
71
  end
72
72
  }
73
73
  if options[:display_search_tags]
74
- tag_names = drilldown.call(node).map(&:to_s)
74
+ tagnames = drilldown.call(node).map(&:to_s)
75
75
  if options[:primary_tag]
76
- tags = [options[:primary_tag]] + tag_names
76
+ tags = [options[:primary_tag]] + tagnames
77
77
  else
78
- tags = tag_names
78
+ tags = tagnames
79
79
  end
80
80
  else
81
81
  tags = nil
@@ -9,16 +9,16 @@ module Hotdog
9
9
  show_tags(result)
10
10
  else
11
11
  tags = args.map { |tag| split_tag(tag) }
12
- if tags.all? { |_tag_name, tag_value| tag_value.empty? }
12
+ if tags.all? { |_tagname, tagvalue| tagvalue.empty? }
13
13
  result = tags.each_slice(SQLITE_LIMIT_COMPOUND_SELECT).flat_map { |tags|
14
14
  q = "SELECT value FROM tags " \
15
- "WHERE %s;" % tags.map { |tag_name, _tag_value| glob?(tag_name) ? "LOWER(name) GLOB LOWER(?)" : "name = ?" }.join(" OR ")
16
- execute(q, tags.map { |tag_name, _tag_value| tag_name }).map { |value| [value] }
15
+ "WHERE %s;" % tags.map { |tagname, _tagvalue| glob?(tagname) ? "LOWER(name) GLOB LOWER(?)" : "name = ?" }.join(" OR ")
16
+ execute(q, tags.map { |tagname, _tagvalue| tagname }).map { |value| [value] }
17
17
  }
18
18
  else
19
19
  result = tags.each_slice(SQLITE_LIMIT_COMPOUND_SELECT / 2).flat_map { |tags|
20
20
  q = "SELECT value FROM tags " \
21
- "WHERE %s;" % tags.map { |tag_name, tag_value| (glob?(tag_name) or glob?(tag_value)) ? "( LOWER(name) GLOB LOWER(?) AND LOWER(value) GLOB LOWER(?) )" : "( name = ? AND value = ? )" }.join(" OR ")
21
+ "WHERE %s;" % tags.map { |tagname, tagvalue| (glob?(tagname) or glob?(tagvalue)) ? "( LOWER(name) GLOB LOWER(?) AND LOWER(value) GLOB LOWER(?) )" : "( name = ? AND value = ? )" }.join(" OR ")
22
22
  execute(q, tags).map { |value| [value] }
23
23
  }
24
24
  end
@@ -63,100 +63,100 @@ module Hotdog
63
63
  rule(unary_op: simple(:unary_op), expression: simple(:expression)) {
64
64
  UnaryExpressionNode.new(unary_op, expression)
65
65
  }
66
- rule(tag_name_regexp: simple(:tag_name_regexp), separator: simple(:separator), tag_value_regexp: simple(:tag_value_regexp)) {
67
- if "/host/" == tag_name_regexp
68
- RegexpHostNode.new(tag_value_regexp, separator)
66
+ rule(tagname_regexp: simple(:tagname_regexp), separator: simple(:separator), tagvalue_regexp: simple(:tagvalue_regexp)) {
67
+ if "/host/" == tagname_regexp
68
+ RegexpHostNode.new(tagvalue_regexp, separator)
69
69
  else
70
- RegexpTagNode.new(tag_name_regexp, tag_value_regexp, separator)
70
+ RegexpTagNode.new(tagname_regexp, tagvalue_regexp, separator)
71
71
  end
72
72
  }
73
- rule(tag_name_regexp: simple(:tag_name_regexp), separator: simple(:separator)) {
74
- if "/host/" == tag_name_regexp
73
+ rule(tagname_regexp: simple(:tagname_regexp), separator: simple(:separator)) {
74
+ if "/host/" == tagname_regexp
75
75
  EverythingNode.new()
76
76
  else
77
- RegexpTagNameNode.new(tag_name_regexp, separator)
77
+ RegexpTagnameNode.new(tagname_regexp, separator)
78
78
  end
79
79
  }
80
- rule(tag_name_regexp: simple(:tag_name_regexp)) {
81
- if "/host/" == tag_name_regexp
80
+ rule(tagname_regexp: simple(:tagname_regexp)) {
81
+ if "/host/" == tagname_regexp
82
82
  EverythingNode.new()
83
83
  else
84
- RegexpHostOrTagNode.new(tag_name_regexp)
84
+ RegexpHostOrTagNode.new(tagname_regexp)
85
85
  end
86
86
  }
87
- rule(tag_name_glob: simple(:tag_name_glob), separator: simple(:separator), tag_value_glob: simple(:tag_value_glob)) {
88
- if "host" == tag_name_glob
89
- GlobHostNode.new(tag_value_glob, separator)
87
+ rule(tagname_glob: simple(:tagname_glob), separator: simple(:separator), tagvalue_glob: simple(:tagvalue_glob)) {
88
+ if "host" == tagname_glob
89
+ GlobHostNode.new(tagvalue_glob, separator)
90
90
  else
91
- GlobTagNode.new(tag_name_glob, tag_value_glob, separator)
91
+ GlobTagNode.new(tagname_glob, tagvalue_glob, separator)
92
92
  end
93
93
  }
94
- rule(tag_name_glob: simple(:tag_name_glob), separator: simple(:separator), tag_value: simple(:tag_value)) {
95
- if "host" == tag_name_glob
96
- GlobHostNode.new(tag_value, separator)
94
+ rule(tagname_glob: simple(:tagname_glob), separator: simple(:separator), tagvalue: simple(:tagvalue)) {
95
+ if "host" == tagname_glob
96
+ GlobHostNode.new(tagvalue, separator)
97
97
  else
98
- GlobTagNode.new(tag_name_glob, tag_value, separator)
98
+ GlobTagNode.new(tagname_glob, tagvalue, separator)
99
99
  end
100
100
  }
101
- rule(tag_name_glob: simple(:tag_name_glob), separator: simple(:separator)) {
102
- if "host" == tag_name_glob
101
+ rule(tagname_glob: simple(:tagname_glob), separator: simple(:separator)) {
102
+ if "host" == tagname_glob
103
103
  EverythingNode.new()
104
104
  else
105
- GlobTagNameNode.new(tag_name_glob, separator)
105
+ GlobTagnameNode.new(tagname_glob, separator)
106
106
  end
107
107
  }
108
- rule(tag_name_glob: simple(:tag_name_glob)) {
109
- if "host" == tag_name_glob
108
+ rule(tagname_glob: simple(:tagname_glob)) {
109
+ if "host" == tagname_glob
110
110
  EverythingNode.new()
111
111
  else
112
- GlobHostOrTagNode.new(tag_name_glob)
112
+ GlobHostOrTagNode.new(tagname_glob)
113
113
  end
114
114
  }
115
- rule(tag_name: simple(:tag_name), separator: simple(:separator), tag_value_glob: simple(:tag_value_glob)) {
116
- if "host" == tag_name
117
- GlobHostNode.new(tag_value_glob, separator)
115
+ rule(tagname: simple(:tagname), separator: simple(:separator), tagvalue_glob: simple(:tagvalue_glob)) {
116
+ if "host" == tagname
117
+ GlobHostNode.new(tagvalue_glob, separator)
118
118
  else
119
- GlobTagNode.new(tag_name, tag_value_glob, separator)
119
+ GlobTagNode.new(tagname, tagvalue_glob, separator)
120
120
  end
121
121
  }
122
- rule(tag_name: simple(:tag_name), separator: simple(:separator), tag_value: simple(:tag_value)) {
123
- if "host" == tag_name
124
- StringHostNode.new(tag_value, separator)
122
+ rule(tagname: simple(:tagname), separator: simple(:separator), tagvalue: simple(:tagvalue)) {
123
+ if "host" == tagname
124
+ StringHostNode.new(tagvalue, separator)
125
125
  else
126
- StringTagNode.new(tag_name, tag_value, separator)
126
+ StringTagNode.new(tagname, tagvalue, separator)
127
127
  end
128
128
  }
129
- rule(tag_name: simple(:tag_name), separator: simple(:separator)) {
130
- if "host" == tag_name
129
+ rule(tagname: simple(:tagname), separator: simple(:separator)) {
130
+ if "host" == tagname
131
131
  EverythingNode.new()
132
132
  else
133
- StringTagNameNode.new(tag_name, separator)
133
+ StringTagnameNode.new(tagname, separator)
134
134
  end
135
135
  }
136
- rule(tag_name: simple(:tag_name)) {
137
- if "host" == tag_name
136
+ rule(tagname: simple(:tagname)) {
137
+ if "host" == tagname
138
138
  EverythingNode.new()
139
139
  else
140
- StringHostOrTagNode.new(tag_name)
140
+ StringHostOrTagNode.new(tagname)
141
141
  end
142
142
  }
143
- rule(separator: simple(:separator), tag_value_regexp: simple(:tag_value_regexp)) {
144
- RegexpTagValueNode.new(tag_value_regexp, separator)
143
+ rule(separator: simple(:separator), tagvalue_regexp: simple(:tagvalue_regexp)) {
144
+ RegexpTagvalueNode.new(tagvalue_regexp, separator)
145
145
  }
146
- rule(tag_value_regexp: simple(:tag_value_regexp)) {
147
- RegexpTagValueNode.new(tag_value_regexp)
146
+ rule(tagvalue_regexp: simple(:tagvalue_regexp)) {
147
+ RegexpTagvalueNode.new(tagvalue_regexp)
148
148
  }
149
- rule(separator: simple(:separator), tag_value_glob: simple(:tag_value_glob)) {
150
- GlobTagValueNode.new(tag_value_glob, separator)
149
+ rule(separator: simple(:separator), tagvalue_glob: simple(:tagvalue_glob)) {
150
+ GlobTagvalueNode.new(tagvalue_glob, separator)
151
151
  }
152
- rule(tag_value_glob: simple(:tag_value_glob)) {
153
- GlobTagValueNode.new(tag_value_glob)
152
+ rule(tagvalue_glob: simple(:tagvalue_glob)) {
153
+ GlobTagvalueNode.new(tagvalue_glob)
154
154
  }
155
- rule(separator: simple(:separator), tag_value: simple(:tag_value)) {
156
- StringTagValueNode.new(tag_value, separator)
155
+ rule(separator: simple(:separator), tagvalue: simple(:tagvalue)) {
156
+ StringTagvalueNode.new(tagvalue, separator)
157
157
  }
158
- rule(tag_value: simple(:tag_value)) {
159
- StringTagValueNode.new(tag_value)
158
+ rule(tagvalue: simple(:tagvalue)) {
159
+ StringTagvalueNode.new(tagvalue)
160
160
  }
161
161
  end
162
162
  end
@@ -14,6 +14,10 @@ module Hotdog
14
14
  def dump(options={})
15
15
  {}
16
16
  end
17
+
18
+ def ==(other)
19
+ self.dump == other.dump
20
+ end
17
21
  end
18
22
 
19
23
  class UnaryExpressionNode < ExpressionNode
@@ -272,7 +276,7 @@ module Hotdog
272
276
  end
273
277
  when :XOR
274
278
  if left == right
275
- []
279
+ NothingNode.new(options)
276
280
  else
277
281
  optimize1(options)
278
282
  end
@@ -355,7 +359,7 @@ module Hotdog
355
359
  if query_without_condition
356
360
  condition_length = expressions.map { |expression| expression.condition_values(options).length }.max
357
361
  expressions.each_slice(SQLITE_LIMIT_COMPOUND_SELECT / condition_length).flat_map { |expressions|
358
- q = query_without_condition.sub(/\s*;\s*\z/, "") + " WHERE " + expressions.map { |expression| "( %s )" % expression.condition(options) }.join(" OR ") + ";"
362
+ q = query_without_condition.sub(/\s*;\s*\z/, " WHERE #{expressions.map { |expression| "( %s )" % expression.condition(options) }.join(" OR ")};")
359
363
  environment.execute(q, expressions.flat_map { |expression| expression.condition_values(options) }).map { |row| row.first }
360
364
  }
361
365
  else
@@ -461,7 +465,7 @@ module Hotdog
461
465
  @args[0] = @args[0].optimize(options)
462
466
  if TagExpressionNode === args[1]
463
467
  # workaround for expressions like `ORDER_BY((environment:development),role)`
464
- @args[1] = @args[1].tag_name
468
+ @args[1] = @args[1].tagname
465
469
  else
466
470
  @args[1] = @args[1]
467
471
  end
@@ -470,7 +474,7 @@ module Hotdog
470
474
  if @args[1]
471
475
  if TagExpressionNode === @args[1]
472
476
  # workaround for expressions like `ORDER_BY((environment:development),role)`
473
- @args[1] = @args[1].tag_name
477
+ @args[1] = @args[1].tagname
474
478
  else
475
479
  @args[1] = @args[1]
476
480
  end
@@ -535,7 +539,7 @@ module Hotdog
535
539
 
536
540
  class NothingNode < QueryExpressionNode
537
541
  def initialize(options={})
538
- super("SELECT NULL AS host_id WHERE host_id NOT NULL", [], options)
542
+ super("SELECT NULL AS host_id WHERE host_id NOT NULL;", [], options)
539
543
  end
540
544
 
541
545
  def evaluate(environment, options={})
@@ -548,22 +552,22 @@ module Hotdog
548
552
  end
549
553
 
550
554
  class TagExpressionNode < ExpressionNode
551
- def initialize(tag_name, tag_value, separator=nil)
552
- @tag_name = tag_name
553
- @tag_value = tag_value
555
+ def initialize(tagname, tagvalue, separator=nil)
556
+ @tagname = tagname
557
+ @tagvalue = tagvalue
554
558
  @separator = separator
555
559
  @fallback = nil
556
560
  end
557
- attr_reader :tag_name
558
- attr_reader :tag_value
561
+ attr_reader :tagname
562
+ attr_reader :tagvalue
559
563
  attr_reader :separator
560
564
 
561
- def tag_name?
562
- !(tag_name.nil? or tag_name.to_s.empty?)
565
+ def tagname?
566
+ !(tagname.nil? or tagname.to_s.empty?)
563
567
  end
564
568
 
565
- def tag_value?
566
- !(tag_value.nil? or tag_value.to_s.empty?)
569
+ def tagvalue?
570
+ !(tagvalue.nil? or tagvalue.to_s.empty?)
567
571
  end
568
572
 
569
573
  def separator?
@@ -573,7 +577,7 @@ module Hotdog
573
577
  def maybe_query(options={})
574
578
  query_without_condition = maybe_query_without_condition(options)
575
579
  if query_without_condition
576
- query_without_condition.sub(/\s*;\s*\z/, "") + " WHERE " + condition(options) + ";"
580
+ query_without_condition.sub(/\s*;\s*\z/, " WHERE #{condition(options)};")
577
581
  else
578
582
  nil
579
583
  end
@@ -654,7 +658,7 @@ module Hotdog
654
658
  end
655
659
 
656
660
  def ==(other)
657
- self.class == other.class and @tag_name == other.tag_name and @tag_value == other.tag_value
661
+ self.class == other.class and @tagname == other.tagname and @tagvalue == other.tagvalue
658
662
  end
659
663
 
660
664
  def optimize(options={})
@@ -685,9 +689,9 @@ module Hotdog
685
689
 
686
690
  def dump(options={})
687
691
  data = {}
688
- data[:tag_name] = tag_name.to_s if tag_name
692
+ data[:tagname] = tagname.to_s if tagname
689
693
  data[:separator] = separator.to_s if separator
690
- data[:tag_value] = tag_value.to_s if tag_value
694
+ data[:tagvalue] = tagvalue.to_s if tagvalue
691
695
  data[:fallback ] = @fallback.dump(options) if @fallback
692
696
  data
693
697
  end
@@ -719,8 +723,8 @@ module Hotdog
719
723
  end
720
724
 
721
725
  class StringHostNode < StringExpressionNode
722
- def initialize(tag_value, separator=nil)
723
- super("host", tag_value.to_s, separator)
726
+ def initialize(tagvalue, separator=nil)
727
+ super("host", tagvalue.to_s, separator)
724
728
  end
725
729
 
726
730
  def condition(options={})
@@ -732,11 +736,11 @@ module Hotdog
732
736
  end
733
737
 
734
738
  def condition_values(options={})
735
- [tag_value]
739
+ [tagvalue]
736
740
  end
737
741
 
738
742
  def maybe_fallback(options={})
739
- fallback = GlobHostNode.new(to_glob(tag_value), separator)
743
+ fallback = GlobHostNode.new(to_glob(tagvalue), separator)
740
744
  query = fallback.maybe_query(options)
741
745
  if query
742
746
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -747,8 +751,8 @@ module Hotdog
747
751
  end
748
752
 
749
753
  class StringTagNode < StringExpressionNode
750
- def initialize(tag_name, tag_value, separator=nil)
751
- super(tag_name.to_s, tag_value.to_s, separator)
754
+ def initialize(tagname, tagvalue, separator=nil)
755
+ super(tagname.to_s, tagvalue.to_s, separator)
752
756
  end
753
757
 
754
758
  def condition(options={})
@@ -760,11 +764,11 @@ module Hotdog
760
764
  end
761
765
 
762
766
  def condition_values(options={})
763
- [tag_name, tag_value]
767
+ [tagname, tagvalue]
764
768
  end
765
769
 
766
770
  def maybe_fallback(options={})
767
- fallback = GlobTagNode.new(to_glob(tag_name), to_glob(tag_value), separator)
771
+ fallback = GlobTagNode.new(to_glob(tagname), to_glob(tagvalue), separator)
768
772
  query = fallback.maybe_query(options)
769
773
  if query
770
774
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -774,9 +778,9 @@ module Hotdog
774
778
  end
775
779
  end
776
780
 
777
- class StringTagNameNode < StringExpressionNode
778
- def initialize(tag_name, separator=nil)
779
- super(tag_name.to_s, nil, separator)
781
+ class StringTagnameNode < StringExpressionNode
782
+ def initialize(tagname, separator=nil)
783
+ super(tagname.to_s, nil, separator)
780
784
  end
781
785
 
782
786
  def condition(options={})
@@ -788,11 +792,11 @@ module Hotdog
788
792
  end
789
793
 
790
794
  def condition_values(options={})
791
- [tag_name]
795
+ [tagname]
792
796
  end
793
797
 
794
798
  def maybe_fallback(options={})
795
- fallback = GlobTagNameNode.new(to_glob(tag_name), separator)
799
+ fallback = GlobTagnameNode.new(to_glob(tagname), separator)
796
800
  query = fallback.maybe_query(options)
797
801
  if query
798
802
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -802,9 +806,9 @@ module Hotdog
802
806
  end
803
807
  end
804
808
 
805
- class StringTagValueNode < StringExpressionNode
806
- def initialize(tag_value, separator=nil)
807
- super(nil, tag_value.to_s, separator)
809
+ class StringTagvalueNode < StringExpressionNode
810
+ def initialize(tagvalue, separator=nil)
811
+ super(nil, tagvalue.to_s, separator)
808
812
  end
809
813
 
810
814
  def condition(options={})
@@ -816,11 +820,11 @@ module Hotdog
816
820
  end
817
821
 
818
822
  def condition_values(options={})
819
- [tag_value, tag_value]
823
+ [tagvalue, tagvalue]
820
824
  end
821
825
 
822
826
  def maybe_fallback(options={})
823
- fallback = GlobTagValueNode.new(to_glob(tag_value), separator)
827
+ fallback = GlobTagvalueNode.new(to_glob(tagvalue), separator)
824
828
  query = fallback.maybe_query(options)
825
829
  if query
826
830
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -831,8 +835,8 @@ module Hotdog
831
835
  end
832
836
 
833
837
  class StringHostOrTagNode < StringExpressionNode
834
- def initialize(tag_name, separator=nil)
835
- super(tag_name.to_s, nil, separator)
838
+ def initialize(tagname, separator=nil)
839
+ super(tagname.to_s, nil, separator)
836
840
  end
837
841
 
838
842
  def condition(options={})
@@ -844,11 +848,11 @@ module Hotdog
844
848
  end
845
849
 
846
850
  def condition_values(options={})
847
- [tag_name, tag_name, tag_name]
851
+ [tagname, tagname, tagname]
848
852
  end
849
853
 
850
854
  def maybe_fallback(options={})
851
- fallback = GlobHostOrTagNode.new(to_glob(tag_name), separator)
855
+ fallback = GlobHostOrTagNode.new(to_glob(tagname), separator)
852
856
  query = fallback.maybe_query(options)
853
857
  if query
854
858
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -861,17 +865,17 @@ module Hotdog
861
865
  class GlobExpressionNode < TagExpressionNode
862
866
  def dump(options={})
863
867
  data = {}
864
- data[:tag_name_glob] = tag_name.to_s if tag_name
868
+ data[:tagname_glob] = tagname.to_s if tagname
865
869
  data[:separator] = separator.to_s if separator
866
- data[:tag_value_glob] = tag_value.to_s if tag_value
870
+ data[:tagvalue_glob] = tagvalue.to_s if tagvalue
867
871
  data[:fallback] = @fallback.dump(options) if @fallback
868
872
  data
869
873
  end
870
874
  end
871
875
 
872
876
  class GlobHostNode < GlobExpressionNode
873
- def initialize(tag_value, separator=nil)
874
- super("host", tag_value.to_s, separator)
877
+ def initialize(tagvalue, separator=nil)
878
+ super("host", tagvalue.to_s, separator)
875
879
  end
876
880
 
877
881
  def condition(options={})
@@ -883,11 +887,11 @@ module Hotdog
883
887
  end
884
888
 
885
889
  def condition_values(options={})
886
- [tag_value]
890
+ [tagvalue]
887
891
  end
888
892
 
889
893
  def maybe_fallback(options={})
890
- fallback = GlobHostNode.new(to_glob(tag_value), separator)
894
+ fallback = GlobHostNode.new(to_glob(tagvalue), separator)
891
895
  query = fallback.maybe_query(options)
892
896
  if query
893
897
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -898,8 +902,8 @@ module Hotdog
898
902
  end
899
903
 
900
904
  class GlobTagNode < GlobExpressionNode
901
- def initialize(tag_name, tag_value, separator=nil)
902
- super(tag_name.to_s, tag_value.to_s, separator)
905
+ def initialize(tagname, tagvalue, separator=nil)
906
+ super(tagname.to_s, tagvalue.to_s, separator)
903
907
  end
904
908
 
905
909
  def condition(options={})
@@ -911,11 +915,11 @@ module Hotdog
911
915
  end
912
916
 
913
917
  def condition_values(options={})
914
- [tag_name, tag_value]
918
+ [tagname, tagvalue]
915
919
  end
916
920
 
917
921
  def maybe_fallback(options={})
918
- fallback = GlobTagNode.new(to_glob(tag_name), to_glob(tag_value), separator)
922
+ fallback = GlobTagNode.new(to_glob(tagname), to_glob(tagvalue), separator)
919
923
  query = fallback.maybe_query(options)
920
924
  if query
921
925
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -925,9 +929,9 @@ module Hotdog
925
929
  end
926
930
  end
927
931
 
928
- class GlobTagNameNode < GlobExpressionNode
929
- def initialize(tag_name, separator=nil)
930
- super(tag_name.to_s, nil, separator)
932
+ class GlobTagnameNode < GlobExpressionNode
933
+ def initialize(tagname, separator=nil)
934
+ super(tagname.to_s, nil, separator)
931
935
  end
932
936
 
933
937
  def condition(options={})
@@ -939,11 +943,11 @@ module Hotdog
939
943
  end
940
944
 
941
945
  def condition_values(options={})
942
- [tag_name]
946
+ [tagname]
943
947
  end
944
948
 
945
949
  def maybe_fallback(options={})
946
- fallback = GlobTagNameNode.new(to_glob(tag_name), separator)
950
+ fallback = GlobTagnameNode.new(to_glob(tagname), separator)
947
951
  query = fallback.maybe_query(options)
948
952
  if query
949
953
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -953,9 +957,9 @@ module Hotdog
953
957
  end
954
958
  end
955
959
 
956
- class GlobTagValueNode < GlobExpressionNode
957
- def initialize(tag_value, separator=nil)
958
- super(nil, tag_value.to_s, separator)
960
+ class GlobTagvalueNode < GlobExpressionNode
961
+ def initialize(tagvalue, separator=nil)
962
+ super(nil, tagvalue.to_s, separator)
959
963
  end
960
964
 
961
965
  def condition(options={})
@@ -967,11 +971,11 @@ module Hotdog
967
971
  end
968
972
 
969
973
  def condition_values(options={})
970
- [tag_value, tag_value]
974
+ [tagvalue, tagvalue]
971
975
  end
972
976
 
973
977
  def maybe_fallback(options={})
974
- fallback = GlobTagValueNode.new(to_glob(tag_value), separator)
978
+ fallback = GlobTagvalueNode.new(to_glob(tagvalue), separator)
975
979
  query = fallback.maybe_query(options)
976
980
  if query
977
981
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -982,8 +986,8 @@ module Hotdog
982
986
  end
983
987
 
984
988
  class GlobHostOrTagNode < GlobExpressionNode
985
- def initialize(tag_name, separator=nil)
986
- super(tag_name.to_s, nil, separator)
989
+ def initialize(tagname, separator=nil)
990
+ super(tagname.to_s, nil, separator)
987
991
  end
988
992
 
989
993
  def condition(options={})
@@ -995,11 +999,11 @@ module Hotdog
995
999
  end
996
1000
 
997
1001
  def condition_values(options={})
998
- [tag_name, tag_name, tag_name]
1002
+ [tagname, tagname, tagname]
999
1003
  end
1000
1004
 
1001
1005
  def maybe_fallback(options={})
1002
- fallback = GlobHostOrTagNode.new(to_glob(tag_name), separator)
1006
+ fallback = GlobHostOrTagNode.new(to_glob(tagname), separator)
1003
1007
  query = fallback.maybe_query(options)
1004
1008
  if query
1005
1009
  QueryExpressionNode.new(query, fallback.condition_values(options))
@@ -1012,21 +1016,21 @@ module Hotdog
1012
1016
  class RegexpExpressionNode < TagExpressionNode
1013
1017
  def dump(options={})
1014
1018
  data = {}
1015
- data[:tag_name_regexp] = tag_name.to_s if tag_name
1019
+ data[:tagname_regexp] = tagname.to_s if tagname
1016
1020
  data[:separator] = separator.to_s if separator
1017
- data[:tag_value_regexp] = tag_value.to_s if tag_value
1021
+ data[:tagvalue_regexp] = tagvalue.to_s if tagvalue
1018
1022
  data[:fallback] = @fallback.dump(options) if @fallback
1019
1023
  data
1020
1024
  end
1021
1025
  end
1022
1026
 
1023
1027
  class RegexpHostNode < RegexpExpressionNode
1024
- def initialize(tag_value, separator=nil)
1025
- case tag_value
1028
+ def initialize(tagvalue, separator=nil)
1029
+ case tagvalue
1026
1030
  when /\A\/(.*)\/\z/
1027
- tag_value = $1
1031
+ tagvalue = $1
1028
1032
  end
1029
- super("host", tag_value, separator)
1033
+ super("host", tagvalue, separator)
1030
1034
  end
1031
1035
 
1032
1036
  def condition(options={})
@@ -1038,21 +1042,21 @@ module Hotdog
1038
1042
  end
1039
1043
 
1040
1044
  def condition_values(options={})
1041
- [tag_value]
1045
+ [tagvalue]
1042
1046
  end
1043
1047
  end
1044
1048
 
1045
1049
  class RegexpTagNode < RegexpExpressionNode
1046
- def initialize(tag_name, tag_value, separator=nil)
1047
- case tag_name
1050
+ def initialize(tagname, tagvalue, separator=nil)
1051
+ case tagname
1048
1052
  when /\A\/(.*)\/\z/
1049
- tag_name = $1
1053
+ tagname = $1
1050
1054
  end
1051
- case tag_value
1055
+ case tagvalue
1052
1056
  when /\A\/(.*)\/\z/
1053
- tag_value = $1
1057
+ tagvalue = $1
1054
1058
  end
1055
- super(tag_name, tag_value, separator)
1059
+ super(tagname, tagvalue, separator)
1056
1060
  end
1057
1061
 
1058
1062
  def condition(options={})
@@ -1064,17 +1068,17 @@ module Hotdog
1064
1068
  end
1065
1069
 
1066
1070
  def condition_values(options={})
1067
- [tag_name, tag_value]
1071
+ [tagname, tagvalue]
1068
1072
  end
1069
1073
  end
1070
1074
 
1071
- class RegexpTagNameNode < RegexpExpressionNode
1072
- def initialize(tag_name, separator=nil)
1073
- case tag_name
1075
+ class RegexpTagnameNode < RegexpExpressionNode
1076
+ def initialize(tagname, separator=nil)
1077
+ case tagname
1074
1078
  when /\A\/(.*)\/\z/
1075
- tag_name = $1
1079
+ tagname = $1
1076
1080
  end
1077
- super(tag_name.to_s, nil, separator)
1081
+ super(tagname.to_s, nil, separator)
1078
1082
  end
1079
1083
 
1080
1084
  def condition(options={})
@@ -1086,17 +1090,17 @@ module Hotdog
1086
1090
  end
1087
1091
 
1088
1092
  def condition_values(options={})
1089
- [tag_name]
1093
+ [tagname]
1090
1094
  end
1091
1095
  end
1092
1096
 
1093
- class RegexpTagValueNode < RegexpExpressionNode
1094
- def initialize(tag_value, separator=nil)
1095
- case tag_value
1097
+ class RegexpTagvalueNode < RegexpExpressionNode
1098
+ def initialize(tagvalue, separator=nil)
1099
+ case tagvalue
1096
1100
  when /\A\/(.*)\/\z/
1097
- tag_value = $1
1101
+ tagvalue = $1
1098
1102
  end
1099
- super(nil, tag_value.to_s, separator)
1103
+ super(nil, tagvalue.to_s, separator)
1100
1104
  end
1101
1105
 
1102
1106
  def condition(options={})
@@ -1108,13 +1112,13 @@ module Hotdog
1108
1112
  end
1109
1113
 
1110
1114
  def condition_values(options={})
1111
- [tag_value, tag_value]
1115
+ [tagvalue, tagvalue]
1112
1116
  end
1113
1117
  end
1114
1118
 
1115
1119
  class RegexpHostOrTagNode < RegexpExpressionNode
1116
- def initialize(tag_name, separator=nil)
1117
- super(tag_name, separator)
1120
+ def initialize(tagname, separator=nil)
1121
+ super(tagname, separator)
1118
1122
  end
1119
1123
 
1120
1124
  def condition(options={})
@@ -1126,7 +1130,7 @@ module Hotdog
1126
1130
  end
1127
1131
 
1128
1132
  def condition_values(options={})
1129
- [tag_name, tag_name, tag_name]
1133
+ [tagname, tagname, tagname]
1130
1134
  end
1131
1135
  end
1132
1136
  end