Class: Rigor::Inference::SyntheticMethod
- Inherits:
-
Object
- Object
- Rigor::Inference::SyntheticMethod
- Defined in:
- lib/rigor/inference/synthetic_method.rb
Overview
ADR-16 Tier C output — one synthetic method declared by a plugin’s ‘Plugin::Macro::HeredocTemplate` entry, after the pre-pass has interpolated the call-site literal symbol into the template name. Stored in SyntheticMethodIndex and consulted by MethodDispatcher below the RBS dispatch tier.
Per ADR-16 § WD13 (cost-bounded best-effort): the v0.1.x delivery commitment is the floor — method names emit; their return types degrade to ‘Dynamic` until slice 6 (precision promotion) routes the recorded `return_type` string through ADR-13’s ‘Plugin::TypeNodeResolver` chain. The string is preserved so the ceiling slice can resolve it without re-walking.
The ‘provenance` Hash carries debug / `–explain` metadata: plugin id, the template’s call shape, and the source location of the originating DSL call. Surfaced through the dispatcher’s ‘macro.tier_c.*` provenance markers.
Constant Summary collapse
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#method_name ⇒ Object
readonly
Returns the value of attribute method_name.
-
#provenance ⇒ Object
readonly
Returns the value of attribute provenance.
-
#return_type ⇒ Object
readonly
Returns the value of attribute return_type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(class_name:, method_name:, return_type:, kind: INSTANCE, provenance: {}) ⇒ SyntheticMethod
constructor
A new instance of SyntheticMethod.
- #instance? ⇒ Boolean
- #singleton? ⇒ Boolean
- #to_h ⇒ Object
Constructor Details
#initialize(class_name:, method_name:, return_type:, kind: INSTANCE, provenance: {}) ⇒ SyntheticMethod
Returns a new instance of SyntheticMethod.
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/rigor/inference/synthetic_method.rb', line 30 def initialize(class_name:, method_name:, return_type:, kind: INSTANCE, provenance: {}) validate!(class_name, method_name, return_type, kind, provenance) @class_name = class_name.dup.freeze @method_name = method_name.to_sym @return_type = return_type.dup.freeze @kind = kind @provenance = provenance.transform_keys(&:to_sym).transform_values do |v| v.is_a?(String) ? v.dup.freeze : v end.freeze freeze end |
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name.
28 29 30 |
# File 'lib/rigor/inference/synthetic_method.rb', line 28 def class_name @class_name end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
28 29 30 |
# File 'lib/rigor/inference/synthetic_method.rb', line 28 def kind @kind end |
#method_name ⇒ Object (readonly)
Returns the value of attribute method_name.
28 29 30 |
# File 'lib/rigor/inference/synthetic_method.rb', line 28 def method_name @method_name end |
#provenance ⇒ Object (readonly)
Returns the value of attribute provenance.
28 29 30 |
# File 'lib/rigor/inference/synthetic_method.rb', line 28 def provenance @provenance end |
#return_type ⇒ Object (readonly)
Returns the value of attribute return_type.
28 29 30 |
# File 'lib/rigor/inference/synthetic_method.rb', line 28 def return_type @return_type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
55 56 57 |
# File 'lib/rigor/inference/synthetic_method.rb', line 55 def ==(other) other.is_a?(SyntheticMethod) && to_h == other.to_h end |
#hash ⇒ Object
60 61 62 |
# File 'lib/rigor/inference/synthetic_method.rb', line 60 def hash to_h.hash end |
#instance? ⇒ Boolean
42 |
# File 'lib/rigor/inference/synthetic_method.rb', line 42 def instance? = kind == INSTANCE |
#singleton? ⇒ Boolean
43 |
# File 'lib/rigor/inference/synthetic_method.rb', line 43 def singleton? = kind == SINGLETON |
#to_h ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/rigor/inference/synthetic_method.rb', line 45 def to_h { "class_name" => class_name, "method_name" => method_name.to_s, "return_type" => return_type, "kind" => kind.to_s, "provenance" => provenance.transform_keys(&:to_s) } end |