Sha256: aa685e338e8dcc3d82c4a90150634ec3939b1af9d4902fb99ff8f4c7e3876bec

Contents?: true

Size: 488 Bytes

Versions: 2

Compression:

Stored size: 488 Bytes

Contents

require 'treetop'
require 'active_record'
require 'active_support/all'
require 'ransack'

require 'nql/version'
require 'nql/grammar'
require 'nql/invalid_expression_error'

module NQL

  def self.to_ransack(query)
    return nil if query.nil? || query.strip.empty?
    expression = parser.parse(query)
    raise InvalidExpressionError.new(parser.failure_reason) unless expression
    expression.to_ransack
  end

  private

  def self.parser
    @@parser ||= SyntaxParser.new
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nql-0.0.5 lib/nql.rb
nql-0.0.4 lib/nql.rb