Sha256: 8176f5d4106efa49ff5c83d6a6ccd40ae89ad068d21616a57a18345534265a79

Contents?: true

Size: 544 Bytes

Versions: 1

Compression:

Stored size: 544 Bytes

Contents

module ActionView
  class Component < Base
  end

  class TemplateRenderer
    module ComponentTemplates
      def render(context, options)
        if options.key?(:component)
          name    = options[:component]
          klass   = "#{name}_component".classify.constantize
          args    = options.except(:component)
          context = args.empty? ? klass.new : klass.new(args)

          super context, template: "components/#{name}"
        else
          super
        end
      end
    end

    prepend ComponentTemplates
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
actionview-component-0.1.0 lib/action_view/component.rb