Sha256: 7b10d6fb128a1e34e79522e86f12b8966950a09aa2eb06c0abe84a3ef4757246

Contents?: true

Size: 543 Bytes

Versions: 1

Compression:

Stored size: 543 Bytes

Contents

module SimpleController
  class Base
    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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_controller-0.1.1 lib/simple_controller/base/core.rb