Module: Inertia::Props

Defined in:
lib/inertia/props.rb

Overview

Contains prop wrapper classes.

Defined Under Namespace

Classes: Base

Constant Summary collapse

Deferred =

A prop that is loaded in a subsequent request after the initial page load.

Base.define(:group, :block)
Once =

A prop that is evaluated only once.

Base.define(:key, :fresh, :expires_in, :block) do
  # Calculates the expiration timestamp in milliseconds.
  #
  # @return [Integer, nil] the expiration time as Unix timestamp in milliseconds, or nil if no expiration
  def expires_at
    return unless expires_in

    ((Time.now + expires_in).to_f * 1_000).to_i
  end
end
Optional =

A prop that is only included in the response when explicitly requested by the client.

Base.define(:block)