Class: LiveCable::Component

Inherits:
Object
  • Object
show all
Includes:
ActiveSupport::Rescuable, Broadcasting, Events, Identification, Lifecycle, MethodDependencyTracking, ReactiveVariables, Rendering, Streaming
Defined in:
lib/live_cable/component.rb,
lib/live_cable/component/events.rb,
lib/live_cable/component/lifecycle.rb,
lib/live_cable/component/rendering.rb,
lib/live_cable/component/streaming.rb,
lib/live_cable/component/broadcasting.rb,
lib/live_cable/component/identification.rb,
lib/live_cable/component/reactive_variables.rb,
lib/live_cable/component/method_dependency_tracking.rb

Defined Under Namespace

Modules: Broadcasting, Events, Identification, Lifecycle, MethodDependencyTracking, ReactiveVariables, Rendering, Streaming

Instance Attribute Summary collapse

Attributes included from ReactiveVariables

#defaults_applied

Instance Method Summary collapse

Methods included from Rendering

#render, #render_in, #rendered_children, #to_partial_path, #variant

Methods included from Events

#dispatch_event, #flush_events

Methods included from Broadcasting

#broadcast, #broadcast_ack, #broadcast_destroy, #broadcast_render, #broadcast_subscribe

Methods included from Lifecycle

#connect, #destroy, #disconnect, #method_missing, #respond_to_missing?, #status, #subscribed?

Methods included from Identification

#channel_name, #live_id

Methods included from ReactiveVariables

#all_reactive_variables, #apply_defaults, #defaults=, #dirty, #prerender_container

Constructor Details

#initialize(id, **defaults) ⇒ Component

Returns a new instance of Component.



20
21
22
23
24
25
# File 'lib/live_cable/component.rb', line 20

def initialize(id, **defaults)
  @id = self.class.resolve_id(id)
  @rendered = false
  @subscribed = false
  @defaults = defaults
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class LiveCable::Component::Lifecycle

Instance Attribute Details

#idString (readonly)

Returns:

  • (String)


18
19
20
# File 'lib/live_cable/component.rb', line 18

def id
  @id
end

#live_connectionObject

Returns the value of attribute live_connection.



15
16
17
# File 'lib/live_cable/component.rb', line 15

def live_connection
  @live_connection
end