Module: NQL::Syntax::Comparison1

Defined in:
lib/nql/grammar.rb

Instance Method Summary collapse

Instance Method Details

#is_node?(node_type) ⇒ Boolean

Returns:

  • (Boolean)


338
339
340
# File 'lib/nql/grammar.rb', line 338

def is_node?(node_type)
  node_type.to_sym == :comparison
end

#to_ransackObject



332
333
334
335
336
# File 'lib/nql/grammar.rb', line 332

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
end