Sha256: 5ceb841792239b78fea80aed05b4bf974592a779024e790b862d37382f1176be

Contents?: true

Size: 837 Bytes

Versions: 7

Compression:

Stored size: 837 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, options = {})
        config.add_filter_group(name, scopes, options)

        define_method name do
          filter_group_by_name(name).value.to_s
        end
      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

7 entries across 7 versions & 1 rubygems

Version Path
admino-0.0.22 lib/admino/query/dsl.rb
admino-0.0.21 lib/admino/query/dsl.rb
admino-0.0.20 lib/admino/query/dsl.rb
admino-0.0.19 lib/admino/query/dsl.rb
admino-0.0.18 lib/admino/query/dsl.rb
admino-0.0.17 lib/admino/query/dsl.rb
admino-0.0.16 lib/admino/query/dsl.rb