Sha256: 6409e9450b294589aff73c0f3d4a5998b0e603deebe52ea0ccf78b54e3046c42

Contents?: true

Size: 788 Bytes

Versions: 9

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_filter 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

9 entries across 9 versions & 1 rubygems

Version Path
chanko-2.0.8 lib/chanko/controller.rb
chanko-2.0.7 lib/chanko/controller.rb
chanko-2.0.6 lib/chanko/controller.rb
chanko-2.0.5 lib/chanko/controller.rb
chanko-2.0.4 lib/chanko/controller.rb
chanko-2.0.3 lib/chanko/controller.rb
chanko-2.0.2 lib/chanko/controller.rb
chanko-2.0.1 lib/chanko/controller.rb
chanko-2.0.0 lib/chanko/controller.rb