Sha256: 8aafc3af6d1e879edcde716a61ce565153c339b11817a8de23d3090897479945
Contents?: true
Size: 1.06 KB
Versions: 2
Compression:
Stored size: 1.06 KB
Contents
require 'active_support/hash_with_indifferent_access' require 'active_support/core_ext/hash' module Admino module Query class Group attr_reader :params attr_reader :config attr_reader :query_i18n_key def initialize(config, params, query_i18n_key = nil) @config = config @params = ActiveSupport::HashWithIndifferentAccess.new(params) @query_i18n_key = query_i18n_key end def augment_scope(scope) if active_scope scope.send(active_scope) else scope end end def active_scope if param_value && available_scopes.include?(param_value.to_sym) param_value.to_sym else nil end end def is_scope_active?(scope) active_scope == scope end def param_value params.fetch(param_name, nil) end def param_name config.name end def available_scopes [nil] + config.scopes end def i18n_key config.name end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
admino-0.0.3 | lib/admino/query/group.rb |
admino-0.0.2 | lib/admino/query/group.rb |