Sha256: 6bed46d7bb053ce57243d135230af1855f88edd7f7afc1bcc75d7439450054db
Contents?: true
Size: 572 Bytes
Versions: 2
Compression:
Stored size: 572 Bytes
Contents
# frozen_string_literal: true # :nocov: module Yattho # Module to allow shorthand calls for Yattho components module ViewHelper class ViewHelperNotFound < StandardError; end HELPERS = { octicon: "Yattho::Beta::Octicon", heading: "Yattho::Beta::Heading", time_ago: "Yattho::TimeAgoComponent", image: "Yattho::Alpha::Image" }.freeze HELPERS.each do |name, component| define_method "yattho_#{name}" do |*args, **kwargs, &block| render component.constantize.new(*args, **kwargs), &block end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yattho_view_components-0.1.1 | app/lib/yattho/view_helper.rb |
yattho_view_components-0.0.1 | app/lib/yattho/view_helper.rb |