Class: Rigor::RbsExtended::AssertEffect

Inherits:
Data
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name

Returns:

  • (Object)

    the current value of class_name



83
84
85
# File 'lib/rigor/rbs_extended.rb', line 83

def class_name
  @class_name
end

#conditionObject (readonly)

Returns the value of attribute condition

Returns:

  • (Object)

    the current value of condition



83
84
85
# File 'lib/rigor/rbs_extended.rb', line 83

def condition
  @condition
end

#negativeObject (readonly)

Returns the value of attribute negative

Returns:

  • (Object)

    the current value of negative



83
84
85
# File 'lib/rigor/rbs_extended.rb', line 83

def negative
  @negative
end

#refinement_typeObject (readonly)

Returns the value of attribute refinement_type

Returns:

  • (Object)

    the current value of refinement_type



83
84
85
# File 'lib/rigor/rbs_extended.rb', line 83

def refinement_type
  @refinement_type
end

#target_kindObject (readonly)

Returns the value of attribute target_kind

Returns:

  • (Object)

    the current value of target_kind



83
84
85
# File 'lib/rigor/rbs_extended.rb', line 83

def target_kind
  @target_kind
end

#target_nameObject (readonly)

Returns the value of attribute target_name

Returns:

  • (Object)

    the current value of target_name



83
84
85
# File 'lib/rigor/rbs_extended.rb', line 83

def target_name
  @target_name
end

Instance Method Details

#always?Boolean

Returns:

  • (Boolean)


84
# File 'lib/rigor/rbs_extended.rb', line 84

def always? = condition == :always

#if_falsey_return?Boolean

Returns:

  • (Boolean)


86
# File 'lib/rigor/rbs_extended.rb', line 86

def if_falsey_return? = condition == :if_falsey_return

#if_truthy_return?Boolean

Returns:

  • (Boolean)


85
# File 'lib/rigor/rbs_extended.rb', line 85

def if_truthy_return? = condition == :if_truthy_return

#negative?Boolean

Returns:

  • (Boolean)


87
# File 'lib/rigor/rbs_extended.rb', line 87

def negative? = negative == true

#refinement?Boolean

Returns:

  • (Boolean)


88
# File 'lib/rigor/rbs_extended.rb', line 88

def refinement? = !refinement_type.nil?