Class: Plumb::AnyClass

Inherits:
Object
  • Object
show all
Includes:
Composable
Defined in:
lib/plumb/any_class.rb

Instance Method Summary collapse

Methods included from Composable

#/, #[], #absorb_input, #absorb_output, #accepted_type, #as_node, #build, #check, #children, #defer, #fusable_step?, #fuse_with, #generate, #idempotent?, included, #input_type, #invalid, #invoke, #match, #metadata, #not, #output_type, #pipeline, #policy, resolve_operand, #static, #subtype_identity, #to_json_schema, #to_mermaid, #to_plumb_type, #to_s, #transform, #value, #where, #with, wrap

Methods included from Callable

#parse, #resolve

Instance Method Details

#&(other) ⇒ Object

Top is the identity of intersection: Any & X == X, mirroring Any | X.



17
# File 'lib/plumb/any_class.rb', line 17

def &(other) = Composable.resolve_operand(other, op: :&, left: self)

#>>(other) ⇒ Object



14
# File 'lib/plumb/any_class.rb', line 14

def >>(other) = Composable.resolve_operand(other, op: :>>, left: self)

#call(result) ⇒ Object



24
# File 'lib/plumb/any_class.rb', line 24

def call(result) = result

#defaultObject

Any.default(value) must trigger default when value is Undefined



20
21
22
# File 'lib/plumb/any_class.rb', line 20

def default(...)
  Types::Undefined.not.default(...)
end

#value_preserving?Boolean

The identity type — accepts anything, changes nothing.

Returns:

  • (Boolean)


27
# File 'lib/plumb/any_class.rb', line 27

def value_preserving? = true

#|(other) ⇒ Object

These shortcuts bypass Composable's operators, but still resolve the operand through the #to_plumb_type hook (an Encoder gets no orientation context from the Any top and falls back to its default direction; a Codec must not leak into the tree as a bare node).



13
# File 'lib/plumb/any_class.rb', line 13

def |(other) = Composable.resolve_operand(other, op: :|, left: self)