Module: Gin::Filterable

Extended by:
GinClass
Included in:
Controller
Defined in:
lib/gin/filterable.rb

Defined Under Namespace

Modules: ClassMethods Classes: InvalidFilterError

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object


7
8
9
# File 'lib/gin/filterable.rb', line 7

def self.included klass
  klass.extend ClassMethods
end

Instance Method Details

#filter(*names) ⇒ Object

Chain-call filters from an action. Raises the filter exception if any filter in the chain fails.

filter :logged_in, :admin

205
206
207
208
209
# File 'lib/gin/filterable.rb', line 205

def filter *names
  names.each do |n|
    instance_eval(&self.filters[n.to_sym])
  end
end