Sha256: 0af7d826ce1f84513424010fda469ea35587ebde2c8d12a264143313ca199259

Contents?: true

Size: 724 Bytes

Versions: 4

Compression:

Stored size: 724 Bytes

Contents

module Admino
  module Query
    module Dsl
      def config
        @config ||= Admino::Query::Configuration.new
      end

      def search_field(name, options = {})
        config.add_search_field(name, options)

        define_method name do
          search_field_by_name(name).value
        end
      end

      def filter_by(name, scopes)
        config.add_filter_group(name, scopes)
      end

      def sorting(*args)
        options = args.extract_options!
        config.add_sorting_scopes(args, options)
      end

      def starting_scope(&block)
        config.starting_scope_callable = block
      end

      def ending_scope(&block)
        config.ending_scope_callable = block
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
admino-0.0.8 lib/admino/query/dsl.rb
admino-0.0.7 lib/admino/query/dsl.rb
admino-0.0.6 lib/admino/query/dsl.rb
admino-0.0.5 lib/admino/query/dsl.rb