Sha256: df1f26e87c9be391627bb4b3b49f67342169f91d456ef0ac62578ab168362022

Contents?: true

Size: 528 Bytes

Versions: 141

Compression:

Stored size: 528 Bytes

Contents

# frozen_string_literal: true

# :nocov:
module Primer
  # Module to allow shorthand calls for Primer components
  module ViewHelper
    class ViewHelperNotFound < StandardError; end

    HELPERS = {
      octicon: "Primer::Beta::Octicon",
      heading: "Primer::Beta::Heading",
      image: "Primer::Alpha::Image"
    }.freeze

    HELPERS.each do |name, component|
      define_method "primer_#{name}" do |*args, **kwargs, &block|
        render component.constantize.new(*args, **kwargs), &block
      end
    end
  end
end

Version data entries

141 entries across 141 versions & 2 rubygems

Version Path
openproject-primer_view_components-0.33.0 app/lib/primer/view_helper.rb
primer_view_components-0.25.1 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.32.1 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.32.0 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.29.1 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.29.0 app/lib/primer/view_helper.rb
primer_view_components-0.23.0 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.28.1 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.28.0 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.27.0 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.26.0 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.25.1 app/lib/primer/view_helper.rb
primer_view_components-0.22.0 app/lib/primer/view_helper.rb
primer_view_components-0.21.1 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.25.0 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.24.0 app/lib/primer/view_helper.rb
primer_view_components-0.21.0 app/lib/primer/view_helper.rb
primer_view_components-0.20.1 app/lib/primer/view_helper.rb
primer_view_components-0.20.0 app/lib/primer/view_helper.rb
openproject-primer_view_components-0.23.0 app/lib/primer/view_helper.rb