Sha256: 694acee86e2f117252af6f136962ffdd2732e177729f681a5f9b8e528c9dd58c
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
module StimulusAttrs::DefaultIdentifier extend ActiveSupport::Concern module ClassMethods def identifier_for_stimulus_attrs # Convert things like 'Admin::UserAvatarComponent' to 'admin--user-avatar' @identifier_for_stimulus_attrs ||= name.gsub('::Component', '').gsub(/Component$/, '') .underscore.gsub('/', '--').gsub('_', '-') end end def identifier_for_stimulus_attrs self.class.identifier_for_stimulus_attrs end ViewComponent::Base.include(self) if defined?(ViewComponent::Base) Phlex::HTML.include(self) if defined?(Phlex::HTML) end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
stimulus_attrs-0.1.0 | lib/stimulus_attrs/default_identifier.rb |