Module: Motion

Defined in:
lib/motion.rb,
lib/motion/event.rb,
lib/motion/errors.rb,
lib/motion/channel.rb,
lib/motion/element.rb,
lib/motion/railtie.rb,
lib/motion/version.rb,
lib/motion/callback.rb,
lib/motion/component.rb,
lib/motion/log_helper.rb,
lib/motion/serializer.rb,
lib/motion/test_helpers.rb,
lib/motion/configuration.rb,
lib/motion/component/motions.rb,
lib/motion/markup_transformer.rb,
lib/motion/component/callbacks.rb,
lib/motion/component/lifecycle.rb,
lib/motion/component/rendering.rb,
lib/motion/revision_calculator.rb,
lib/motion/component/broadcasts.rb,
lib/motion/component_connection.rb,
lib/motion/action_cable_extentions.rb,
lib/motion/component/periodic_timers.rb,
lib/generators/motion/install_generator.rb,
lib/generators/motion/component_generator.rb,
lib/motion/action_cable_extentions/log_suppression.rb,
lib/motion/action_cable_extentions/synchronization.rb,
lib/motion/action_cable_extentions/declarative_streams.rb,
lib/motion/action_cable_extentions/declarative_notifications.rb

Defined Under Namespace

Modules: ActionCableExtentions, Component, Generators, TestHelpers Classes: AlreadyConfiguredError, BadRevisionError, BadRevisionPathsError, BadSecretError, BlockNotAllowedError, Callback, Channel, ComponentConnection, ComponentError, ComponentRenderingError, Configuration, Element, Error, Event, IncompatibleClientError, InvalidComponentStateError, InvalidSerializedStateError, LogHelper, MarkupTransformer, MotionNotMapped, MultipleRootsError, MyRailtie, RenderAborted, RevisionCalculator, SerializedComponentError, Serializer, UnrepresentableStateError, UpgradeNotImplementedError

Constant Summary collapse

VERSION =
"0.7.1"

Class Method Summary collapse

Class Method Details

.build_renderer_for(websocket_connection) ⇒ Object



43
44
45
# File 'lib/motion.rb', line 43

def build_renderer_for(websocket_connection)
  config.renderer_for_connection_proc.call(websocket_connection)
end

.configObject Also known as: configuration



29
30
31
# File 'lib/motion.rb', line 29

def config
  @config ||= Configuration.default
end

.configure(&block) ⇒ Object



23
24
25
26
27
# File 'lib/motion.rb', line 23

def configure(&block)
  raise AlreadyConfiguredError if @config

  @config = Configuration.new(&block)
end

.markup_transformerObject



39
40
41
# File 'lib/motion.rb', line 39

def markup_transformer
  @markup_transformer ||= MarkupTransformer.new
end

.notify_error(error, message) ⇒ Object



47
48
49
# File 'lib/motion.rb', line 47

def notify_error(error, message)
  config.error_notification_proc&.call(error, message)
end

.reset_internal_state_for_testing!(new_configuration = nil) ⇒ Object

This method only exists for testing. Changing configuration while Motion is in use is not supported. It is only safe to call this method when no components are currently mounted.



54
55
56
57
58
# File 'lib/motion.rb', line 54

def reset_internal_state_for_testing!(new_configuration = nil)
  @config = new_configuration
  @serializer = nil
  @markup_transformer = nil
end

.serializerObject



35
36
37
# File 'lib/motion.rb', line 35

def serializer
  @serializer ||= Serializer.new
end