Sha256: c4356f387030b66bcbe5c59bc65bb9afdbc60eecf51810f608d413180e8fe583

Contents?: true

Size: 788 Bytes

Versions: 5

Compression:

Stored size: 788 Bytes

Contents

module Chanko
  module Controller
    extend ActiveSupport::Concern

    module ClassMethods
      private

      def inherited(base)
        if Config.auto_reload && base.name == "ApplicationController"
          base.class_eval do
            prepend_before_action do
              Chanko::Loader.cache.clear
            end
          end
        end
        super
      end

      def unit_action(unit_name, *function_names, &block)
        options = function_names.extract_options!
        block ||= Proc.new { head 400 }
        Array.wrap(function_names).each do |function_name|
          define_method(function_name) do
            invoke(unit_name, function_name, options, &block)
          end
        end
      end
      alias_method :ext_action, :unit_action
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
chanko-2.3.0 lib/chanko/controller.rb
chanko-2.2.1 lib/chanko/controller.rb
chanko-2.2.0 lib/chanko/controller.rb
chanko-2.1.1 lib/chanko/controller.rb
chanko-2.1.0 lib/chanko/controller.rb