Sha256: 1fdad4ecdf6c4a803e91e6a0e5a6bff60de40654d1a6ff4c9b0a51837de77860

Contents?: true

Size: 590 Bytes

Versions: 294

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

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

    HELPERS = {
      heroicon: "Ariadne::HeroiconComponent",
      heading: "Ariadne::HeadingComponent",
      time_ago: "Ariadne::TimeAgoComponent",
      image: "Ariadne::ImageComponent",
    }.freeze

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

Version data entries

294 entries across 294 versions & 1 rubygems

Version Path
ariadne_view_components-0.0.52 app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.52-x64-mingw-ucrt app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.51-x64-mingw-ucrt app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.51-x86_64-darwin app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.51-arm64-darwin app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.51-aarch64-linux app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.51 app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.51-x86_64-linux app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.50 app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.50-arm64-darwin app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.50-x64-mingw-ucrt app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.50-x86_64-darwin app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.50-x86_64-linux app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.50-aarch64-linux app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.49-aarch64-linux app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.49-x86_64-darwin app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.49-x86_64-linux app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.49-arm64-darwin app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.49-x64-mingw-ucrt app/lib/ariadne/view_helper.rb
ariadne_view_components-0.0.49 app/lib/ariadne/view_helper.rb