Sha256: b7d8238715570e5278de5815d4fc6d058e9257542a14445986080dec365cbbc2

Contents?: true

Size: 482 Bytes

Versions: 8

Compression:

Stored size: 482 Bytes

Contents

# frozen_string_literal: true

require "active_support/concern"
require "active_support/core_ext/hash/reverse_merge"

module Haku
  module Controller
    extend ActiveSupport::Concern

    included do
      attr_reader :execution
    end

    def execute(action, params={})
      @execution = action.call(params.reverse_merge(default_execute_params || {}))
    end

    def default_execute_params
      { current_user: current_user } if respond_to?(:current_user)
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
haku-1.5.0 lib/haku/controller.rb
haku-1.4.0 lib/haku/controller.rb
haku-1.3.1 lib/haku/controller.rb
haku-1.3.0 lib/haku/controller.rb
haku-1.2.1 lib/haku/controller.rb
haku-1.2.0 lib/haku/controller.rb
haku-1.1.0 lib/haku/controller.rb
haku-1.0.0 lib/haku/controller.rb