Class: Rigor::RbsExtended::AssertEffect
- Inherits:
-
Data
- Object
- Data
- Rigor::RbsExtended::AssertEffect
- Defined in:
- lib/rigor/rbs_extended.rb
Overview
Returned for ‘assert` / `assert-if-true` / `assert-if-false`. `condition` is one of:
-
‘:always` — refines `target` at the call’s
post-scope unconditionally (`assert`). -
‘:if_truthy_return` — refines `target` only when the
call's return value is observed as truthy (currently: as the predicate of a subsequent `if` / `unless`). -
‘:if_falsey_return` — symmetric for falsey.
‘negative` mirrors `PredicateEffect`: true when the directive uses `~ClassName` syntax.
Instance Attribute Summary collapse
-
#class_name ⇒ Object
readonly
Returns the value of attribute class_name.
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#negative ⇒ Object
readonly
Returns the value of attribute negative.
-
#refinement_type ⇒ Object
readonly
Returns the value of attribute refinement_type.
-
#target_kind ⇒ Object
readonly
Returns the value of attribute target_kind.
-
#target_name ⇒ Object
readonly
Returns the value of attribute target_name.
Instance Method Summary collapse
- #always? ⇒ Boolean
- #if_falsey_return? ⇒ Boolean
- #if_truthy_return? ⇒ Boolean
- #negative? ⇒ Boolean
- #refinement? ⇒ Boolean
-
#to_fact ⇒ Object
ADR-7 § “Slice 4-A” canonical translation.
Instance Attribute Details
#class_name ⇒ Object (readonly)
Returns the value of attribute class_name
101 102 103 |
# File 'lib/rigor/rbs_extended.rb', line 101 def class_name @class_name end |
#condition ⇒ Object (readonly)
Returns the value of attribute condition
101 102 103 |
# File 'lib/rigor/rbs_extended.rb', line 101 def condition @condition end |
#negative ⇒ Object (readonly)
Returns the value of attribute negative
101 102 103 |
# File 'lib/rigor/rbs_extended.rb', line 101 def negative @negative end |
#refinement_type ⇒ Object (readonly)
Returns the value of attribute refinement_type
101 102 103 |
# File 'lib/rigor/rbs_extended.rb', line 101 def refinement_type @refinement_type end |
#target_kind ⇒ Object (readonly)
Returns the value of attribute target_kind
101 102 103 |
# File 'lib/rigor/rbs_extended.rb', line 101 def target_kind @target_kind end |
#target_name ⇒ Object (readonly)
Returns the value of attribute target_name
101 102 103 |
# File 'lib/rigor/rbs_extended.rb', line 101 def target_name @target_name end |
Instance Method Details
#always? ⇒ Boolean
102 |
# File 'lib/rigor/rbs_extended.rb', line 102 def always? = condition == :always |
#if_falsey_return? ⇒ Boolean
104 |
# File 'lib/rigor/rbs_extended.rb', line 104 def if_falsey_return? = condition == :if_falsey_return |
#if_truthy_return? ⇒ Boolean
103 |
# File 'lib/rigor/rbs_extended.rb', line 103 def if_truthy_return? = condition == :if_truthy_return |
#negative? ⇒ Boolean
105 |
# File 'lib/rigor/rbs_extended.rb', line 105 def negative? = negative == true |
#refinement? ⇒ Boolean
106 |
# File 'lib/rigor/rbs_extended.rb', line 106 def refinement? = !refinement_type.nil? |
#to_fact ⇒ Object
ADR-7 § “Slice 4-A” canonical translation. Same shape as ‘PredicateEffect#to_fact`; the `condition` field (`:always` / `:if_truthy_return` / `:if_falsey_return`) routes which slot the resulting fact lands in at the `read_flow_contribution` boundary, but does not surface on the Fact itself.
114 115 116 117 118 119 120 121 |
# File 'lib/rigor/rbs_extended.rb', line 114 def to_fact FlowContribution::Fact.new( target_kind: target_kind, target_name: target_name, type: refinement_type || Rigor::Type::Combinator.nominal_of(class_name), negative: negative == true ) end |