Class: Filterameter::Filters::ScopeFilter

Inherits:
Object
  • Object
show all
Includes:
Errors
Defined in:
lib/filterameter/filters/scope_filter.rb

Overview

# Scope Filter

Class ScopeFilter applies the named scope passing in the parameter value.

Direct Known Subclasses

Sorts::ScopeSort

Instance Attribute Summary

Attributes included from Errors

#errors

Instance Method Summary collapse

Methods included from Errors

#valid?

Constructor Details

#initialize(scope_name) ⇒ ScopeFilter

Returns a new instance of ScopeFilter.



11
12
13
# File 'lib/filterameter/filters/scope_filter.rb', line 11

def initialize(scope_name)
  @scope_name = scope_name
end

Instance Method Details

#apply(query, value) ⇒ Object



15
16
17
# File 'lib/filterameter/filters/scope_filter.rb', line 15

def apply(query, value)
  query.public_send(@scope_name, value)
end