Sha256: d54ec03d95e2a10e3e79d2cd947b2453914061019a5339552c1319962d7727f5

Contents?: true

Size: 484 Bytes

Versions: 1

Compression:

Stored size: 484 Bytes

Contents

module SimpleController
  module Core
    extend ActiveSupport::Concern

    included do
      attr_reader :params, :action_name
    end

    def call(action_name, params={})
      @params ||= ActiveSupport::HashWithIndifferentAccess.new(params)
      @action_name ||= action_name.to_s

      call_action
    end

    protected

    def call_action
      public_send action_name
    end

    module ClassMethods
      def call(*args)
        new.call *args
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_controller-0.1.0 lib/simple_controller/core.rb