Class: Iriq::CrossHostShape
- Inherits:
-
Object
- Object
- Iriq::CrossHostShape
- Defined in:
- lib/iriq/cross_host_shape.rb
Overview
A route shape that recurs across multiple hosts.
Emitted by Corpus#cross_host_shapes. The shape string (“/users/user_id”) is the cluster’s rendered placeholder form; two clusters with the same shape but different hosts coalesce into one CrossHostShape record.
A shape appearing at N hosts is strong evidence of a semantic pattern rather than a host-local quirk — independent hosts are unlikely to invent the same ‘/users/integer` structure by accident. Future work can feed this signal into proposal confidence and corpus-informed normalization (raise weight when a Shape has cross-host support).
Instance Attribute Summary collapse
-
#hosts ⇒ Object
readonly
Returns the value of attribute hosts.
-
#observation_count ⇒ Object
readonly
Returns the value of attribute observation_count.
-
#shape ⇒ Object
readonly
Returns the value of attribute shape.
Instance Method Summary collapse
- #host_count ⇒ Object
-
#initialize(shape:, hosts:, observation_count:) ⇒ CrossHostShape
constructor
A new instance of CrossHostShape.
- #to_h ⇒ Object
Constructor Details
#initialize(shape:, hosts:, observation_count:) ⇒ CrossHostShape
Returns a new instance of CrossHostShape.
18 19 20 21 22 |
# File 'lib/iriq/cross_host_shape.rb', line 18 def initialize(shape:, hosts:, observation_count:) @shape = shape @hosts = hosts.is_a?(Set) ? hosts.dup.freeze : Set.new(hosts).freeze @observation_count = observation_count end |
Instance Attribute Details
#hosts ⇒ Object (readonly)
Returns the value of attribute hosts.
16 17 18 |
# File 'lib/iriq/cross_host_shape.rb', line 16 def hosts @hosts end |
#observation_count ⇒ Object (readonly)
Returns the value of attribute observation_count.
16 17 18 |
# File 'lib/iriq/cross_host_shape.rb', line 16 def observation_count @observation_count end |
#shape ⇒ Object (readonly)
Returns the value of attribute shape.
16 17 18 |
# File 'lib/iriq/cross_host_shape.rb', line 16 def shape @shape end |
Instance Method Details
#host_count ⇒ Object
24 25 26 |
# File 'lib/iriq/cross_host_shape.rb', line 24 def host_count @hosts.size end |
#to_h ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/iriq/cross_host_shape.rb', line 28 def to_h { shape: @shape, hosts: @hosts.to_a.sort, host_count: host_count, observation_count: @observation_count, } end |