Sha256: 4989a83d16bd5938593b3f0a878437b39cf1b23deb76eddd403c4c4020532c84

Contents?: true

Size: 610 Bytes

Versions: 2

Compression:

Stored size: 610 Bytes

Contents

module Vicar
  module RailsExtensions
    module ActionView
      # Create presenter from app/presenters and call method
      #
      # name   - Symbol
      # action - Symbol
      # args   - arguments for presenter method
      #
      # Yields the presenter instance
      #
      # Examples
      #
      #   - presenter :company, :awards, @company
      #
      # Returns variant
      def presenter(name, action, *args)
        presenter = "#{name.to_s.camelize}Presenter".constantize.new(self)

        yield(presenter) if block_given?

        presenter.send(action, *args)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vicar-0.0.2 lib/vicar/rails_extensions/action_view.rb
vicar-0.0.1 lib/vicar/rails_extensions/action_view.rb