Class: ActionEvent::Base

Inherits:
Object
  • Object
show all
Includes:
ActionController::UrlWriter
Defined in:
lib/action_event/base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



12
13
14
# File 'lib/action_event/base.rb', line 12

def initialize(params)
  @params = params.clone
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *params, &block) ⇒ Object (protected)



52
53
54
# File 'lib/action_event/base.rb', line 52

def method_missing(method, *params, &block)
  template.send(method, *params, &block)
end

Instance Attribute Details

#paramsObject

Returns the value of attribute params.



6
7
8
# File 'lib/action_event/base.rb', line 6

def params
  @params
end

Class Method Details

.before_filter(method) ⇒ Object



22
23
24
# File 'lib/action_event/base.rb', line 22

def self.before_filter(method)
  filter_chain.push(method.to_sym)
end

.helper(*names) ⇒ Object



30
31
32
33
34
35
36
37
38
# File 'lib/action_event/base.rb', line 30

def self.helper(*names)
  names.each do |name|
    case name
      when String, Symbol then helper("#{name.to_s.underscore}_helper".classify.constantize)
      when Module then master_helper_module.module_eval { include name }
      else raise
    end
  end
end

.process(params = {}) ⇒ Object



16
17
18
19
20
# File 'lib/action_event/base.rb', line 16

def self.process(params={})
  action_event = new(params)
  filter_chain.each { |chain| action_event.send(chain) }
  action_event.process
end

.skip_before_filter(method) ⇒ Object



26
27
28
# File 'lib/action_event/base.rb', line 26

def self.skip_before_filter(method)
  filter_chain.delete(method.to_sym)
end

.view_pathsObject



8
9
10
# File 'lib/action_event/base.rb', line 8

def self.view_paths
  @view_paths ||= ActionView::Base.process_view_paths(Rails::Configuration.new.view_path)
end