lib/nql/grammar.rb in nql-0.0.1 vs lib/nql/grammar.rb in nql-0.0.2
- old
+ new
@@ -61,18 +61,18 @@
end
end
module Boolean1
def to_ransack
- group = {'g' => [{'m' => coordinator.to_ransack}]}
+ group = {g: [{m: coordinator.to_ransack}]}
[left, right].each do |side|
if side.is_node?(:boolean)
- group['g'][0].merge! side.to_ransack
+ group[:g][0].merge! side.to_ransack
else
- group['g'][0]['c'] ||= []
- group['g'][0]['c'] << side.to_ransack
+ group[:g][0][:c] ||= []
+ group[:g][0][:c] << side.to_ransack
end
end
group
end
@@ -328,11 +328,11 @@
end
end
module Comparison1
def to_ransack
- hash = {'a' => {'0' => {'name' => self.variable.text_value.gsub('.', '_')}}, 'p' => self.comparator.to_ransack, 'v' => {'0' => {'value' => self.value.text_value}}}
- hash = {'c' => [hash]} if !parent || !parent.parent || text_value == parent.parent.text_value
+ hash = {a: {'0' => {name: self.variable.text_value.gsub('.', '_')}}, p: self.comparator.to_ransack, v: {'0' => {value: self.value.text_value}}}
+ hash = {c: [hash]} if !parent || !parent.parent || text_value == parent.parent.text_value
hash
end
def is_node?(node_type)
node_type.to_sym == :comparison
\ No newline at end of file