Sha256: 9006a1d74e657495c6147c704e98e20365fcf7a6e6166b878b04ca7b5c9e96e6

Contents?: true

Size: 952 Bytes

Versions: 1

Compression:

Stored size: 952 Bytes

Contents

require 'pacer/filter/where_filter/node_visitor'

module Pacer
  module Routes
    module RouteOperations
      def where(str, values = {})
        chain_route :filter => :where, :where_statement => str, :values => values
      end
    end
  end

  module Filter
    module WhereFilter
      attr_reader :where_statement
      attr_accessor :values

      def where_statement=(str)
        @where_statement = str
        @built = @parsed = @intermediate = nil
      end

      def parsed
        @parsed ||= JRuby.parse @where_statement
      end

      def intermediate
        @intermediate ||= parsed.accept(NodeVisitor.new(self, values || {}))
      end

      def build!
        @built ||= intermediate.build
      end

      protected

      def attach_pipe(end_pipe)
        pipe = build!
        pipe.setStarts end_pipe if end_pipe
        pipe
      end

      def inspect_string
        "where(#@where_statement)"
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pacer-0.9.1.1-java lib/pacer/filter/where_filter.rb