Module: Zillabyte::Queries
- Defined in:
- lib/zillabyte/queries.rb
Class Method Summary collapse
Class Method Details
.array_to_sxp_expression(exp) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/zillabyte/queries.rb', line 5 def self.array_to_sxp_expression(exp) s = [] s << "(" s << exp[0] exp[1].each do |ss| s << " " s << ss end s << ")" s = s.join("") end |
.convert_clause_to_sxp(match) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/zillabyte/queries.rb', line 18 def self.convert_clause_to_sxp(match) return nil if match.nil? or match.size == 0 queue = match.clone s = array_to_sxp_expression(queue.shift) while queue.size > 0 next_exp = array_to_sxp_expression(queue.shift) s = "(and #{s} #{next_exp})" end s end |