Class: Phlex::Reactive::Component::ComputeDefinition

Inherits:
Data
  • Object
show all
Defined in:
lib/phlex/reactive/component.rb

Overview

A declared client-side computation (data binding). inputs/outputs are the action-param names of the fields the reducer reads/writes; reducer is the key a JS function is registered under (Reactive.compute(key, fn)). The generic controller runs the reducer on input — writing outputs with NO round trip — then the debounced POST reconciles from the server reply.

input_types (issue #104) is nil for the ARRAY input form (untyped ⇒ the client coerces every input through Number, the shipped behavior) and a { name => type } hash for the typed HASH form (:string reads the field value raw, :number coerces). inputs stays the ordered name list either way, so iteration order is preserved and the array-form wire is unchanged.

mirror (issue #159) is nil when undeclared, else a { name => [id selectors] } map — DECLARED cross-root text mirrors, validated to id selectors only at declare time (the server half of the two-sided default-deny; the client interpreter re-checks the shape).

Instance Attribute Summary collapse

Instance Attribute Details

#input_typesObject (readonly)

Returns the value of attribute input_types

Returns:

  • (Object)

    the current value of input_types



94
95
96
# File 'lib/phlex/reactive/component.rb', line 94

def input_types
  @input_types
end

#inputsObject (readonly)

Returns the value of attribute inputs

Returns:

  • (Object)

    the current value of inputs



94
95
96
# File 'lib/phlex/reactive/component.rb', line 94

def inputs
  @inputs
end

#mirrorObject (readonly)

Returns the value of attribute mirror

Returns:

  • (Object)

    the current value of mirror



94
95
96
# File 'lib/phlex/reactive/component.rb', line 94

def mirror
  @mirror
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



94
95
96
# File 'lib/phlex/reactive/component.rb', line 94

def name
  @name
end

#outputsObject (readonly)

Returns the value of attribute outputs

Returns:

  • (Object)

    the current value of outputs



94
95
96
# File 'lib/phlex/reactive/component.rb', line 94

def outputs
  @outputs
end

#reducerObject (readonly)

Returns the value of attribute reducer

Returns:

  • (Object)

    the current value of reducer



94
95
96
# File 'lib/phlex/reactive/component.rb', line 94

def reducer
  @reducer
end