Module: ClassAction

Defined in:
lib/class_action.rb,
lib/class_action/action.rb,
lib/class_action/version.rb,
lib/class_action/rspec/respond_with_matcher.rb,
lib/class_action/rspec/have_class_action_matcher.rb,
lib/class_action/rspec/respond_to_format_matcher.rb,
lib/class_action/rspec/class_action_example_group.rb

Defined Under Namespace

Modules: ClassMethods, RSpec Classes: Action, ActionNotAvailable

Constant Summary collapse

VERSION =
"1.3.2"

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(target) ⇒ Object



9
10
11
12
13
# File 'lib/class_action.rb', line 9

def included(target)
  target.extend ClassMethods
  target.action_load_path = []
  setup target
end

.setup(target) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/class_action.rb', line 15

def setup(target)
  target.class_eval <<-RUBY, __FILE__, __LINE__+1
    def class_action
      @_class_action
    end
  RUBY
end

Instance Method Details

#_protected_ivarsObject

:nodoc:



156
157
158
# File 'lib/class_action.rb', line 156

def _protected_ivars # :nodoc:
  super + %i(@_class_action)
end

#view_contextObject



145
146
147
148
149
150
151
152
153
154
# File 'lib/class_action.rb', line 145

def view_context
  view_context = super

  if class_action
    # Extend the current view context with the action helpers.
    view_context.singleton_class.send :include, class_action.class.helpers
  end

  view_context
end