Class: Hyde::Probe

Inherits:
Node
  • Object
show all
Defined in:
lib/hyde/probe.rb

Overview

Test probe. Also base for all "reactive" nodes.

Direct Known Subclasses

Handlers::Handler, Handlers::Serve

Instance Attribute Summary collapse

Attributes inherited from Node

#remap, #root

Instance Method Summary collapse

Methods inherited from Node

#go, #reject

Constructor Details

#initialize(path, parent:) ⇒ Probe

Returns a new instance of Probe.

Parameters:



41
42
43
# File 'lib/hyde/probe.rb', line 41

def initialize(path, parent:)
  super(path, parent: parent)
end

Instance Attribute Details

#propertiesObject (readonly)

Returns the value of attribute properties.



45
46
47
# File 'lib/hyde/probe.rb', line 45

def properties
  @properties
end

Instance Method Details

#process(request) ⇒ Boolean

Method callback on successful request navigation. Throws an error upon reaching the path. This behaviour should only be used internally.

Parameters:

Returns:

  • (Boolean)

    true if further navigation is possible

Raises:

  • (StandardError)


53
54
55
56
57
58
59
60
# File 'lib/hyde/probe.rb', line 53

def process(request)
  return reject(request) unless request.path.match?(/^\/?$/)

  raise StandardError, <<~STREND
    probe reached #{request.splat.inspect}, #{request.param.inspect}
    #{request.pretty_inspect}
  STREND
end