Module: Spine::Actions::Filters

Included in:
Action
Defined in:
lib/spine/actions/filters.rb

Instance Method Summary collapse

Instance Method Details

#after(method_name) ⇒ Object



8
9
10
# File 'lib/spine/actions/filters.rb', line 8

def after(method_name)
  after_filters << method_name
end

#after_filtersObject



31
32
33
# File 'lib/spine/actions/filters.rb', line 31

def after_filters
  @after_filters ||= []
end

#after_filters_with_parentsObject



35
36
37
38
39
40
41
# File 'lib/spine/actions/filters.rb', line 35

def after_filters_with_parents
  if superclass.respond_to?(:after_filters_with_parents)
    after_filters + superclass.after_filters_with_parents
  else
    after_filters
  end
end

#before(method_name) ⇒ Object



4
5
6
# File 'lib/spine/actions/filters.rb', line 4

def before(method_name)
  before_filters << method_name
end

#before_filtersObject



19
20
21
# File 'lib/spine/actions/filters.rb', line 19

def before_filters
  @before_filters ||= []
end

#before_filters_with_parentsObject



23
24
25
26
27
28
29
# File 'lib/spine/actions/filters.rb', line 23

def before_filters_with_parents
  if superclass.respond_to?(:before_filters_with_parents)
    superclass.before_filters_with_parents + before_filters
  else
    before_filters
  end
end

#process_filters(handler, filters) ⇒ Object



12
13
14
15
16
17
# File 'lib/spine/actions/filters.rb', line 12

def process_filters(handler, filters)
  filters.detect do |name|
    handler.public_send(name) if handler.respond_to?(name)
    handler.responded?
  end
end