Module: Flame::Controller::ParentActions

Defined in:
lib/flame/controller.rb

Overview

Module for public instance methods re-defining from superclass

Examples:

Inherit controller with parent actions by extend

class MyController < BaseController
  extend Flame::Controller::ParentActions
end

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(ctrl) ⇒ Object



131
132
133
# File 'lib/flame/controller.rb', line 131

def self.extended(ctrl)
  ctrl.define_parent_actions
end

Instance Method Details

#define_parent_actions ⇒ Object



135
136
137
138
139
140
# File 'lib/flame/controller.rb', line 135

def define_parent_actions
  superclass.public_instance_methods(false).each do |public_method|
    um = superclass.public_instance_method(public_method)
    define_method public_method, um
  end
end

#inherited(ctrl) ⇒ Object



127
128
129
# File 'lib/flame/controller.rb', line 127

def inherited(ctrl)
  ctrl.define_parent_actions
end