Class: Anchor::Component

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
FetchOrFallbackHelper, ViewHelper
Defined in:
app/components/anchor/component.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ViewHelper

#text_prose

Methods included from FetchOrFallbackHelper

#fetch_or_fallback

Constructor Details

#initialize(classes: nil, data: {}, **kwargs) ⇒ Component

Returns a new instance of Component.



10
11
12
13
14
15
# File 'app/components/anchor/component.rb', line 10

def initialize(classes: nil, data: {}, **kwargs)
  @classes = classes
  @data = data

  super
end

Class Method Details

.generate_id(base_name: name.demodulize.underscore.dasherize) ⇒ Object



6
7
8
# File 'app/components/anchor/component.rb', line 6

def self.generate_id(base_name: name.demodulize.underscore.dasherize)
  "#{base_name}-#{SecureRandom.uuid}"
end