Sha256: 64ae82f496f908cc3dae3dbb862608ffc720f3d8c969466372e6b7b93e103aa9

Contents?: true

Size: 831 Bytes

Versions: 4

Compression:

Stored size: 831 Bytes

Contents

require 'aldous/respondable/base'

module Aldous
  module Respondable
    class SendData < Base
      def action(controller)
        SendDataAction.new(data, options, controller, view_data)
      end

      def data
        raise Errors::UserError.new("SendData objects must define a 'data' method")
      end

      def options
        raise Errors::UserError.new("SendData objects must define an 'options' method")
      end

      private

      class SendDataAction
        attr_reader :controller, :view_data, :data, :options

        def initialize(data, options, controller, view_data)
          @controller = controller
          @view_data = view_data
          @data = data
          @options = options
        end

        def execute
          controller.send_data data, options
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
aldous-1.1.3 lib/aldous/respondable/send_data.rb
aldous-1.1.2 lib/aldous/respondable/send_data.rb
aldous-1.0.1 lib/aldous/respondable/send_data.rb
aldous-1.0.0 lib/aldous/respondable/send_data.rb