Module: LiveComponent::Base::InstanceMethods

Defined in:
lib/live_component/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#__lc_attributesObject (readonly)

Returns the value of attribute __lc_attributes.



148
149
150
# File 'lib/live_component/base.rb', line 148

def __lc_attributes
  @__lc_attributes
end

Instance Method Details

#__lc_idObject



150
151
152
# File 'lib/live_component/base.rb', line 150

def __lc_id
  @__lc_id ||= @__lc_attributes["data-id"] || SecureRandom.uuid
end

#fn(method_name) ⇒ Object



154
155
156
# File 'lib/live_component/base.rb', line 154

def fn(method_name)
  "fn:#{__lc_id}##{method_name}"
end

#on(event_name) ⇒ Object



158
159
160
# File 'lib/live_component/base.rb', line 158

def on(event_name)
  Action.new(__lc_controller, event_name)
end

#target(target_name) ⇒ Object



162
163
164
# File 'lib/live_component/base.rb', line 162

def target(target_name)
  Target.new(__lc_controller, target_name)
end