Class: RBS::Test::ArgumentsReturn

Inherits:
Object
  • Object
show all
Includes:
Guaranteed::Inspect
Defined in:
lib/rbs/test.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Guaranteed::Inspect

guaranteed_inspect, #inspect

Constructor Details

#initialize(arguments:, exit_value:, exit_type:) ⇒ ArgumentsReturn

Returns a new instance of ArgumentsReturn.



33
34
35
36
37
# File 'lib/rbs/test.rb', line 33

def initialize(arguments:, exit_value:, exit_type:)
  @arguments = arguments
  @exit_value = exit_value
  @exit_type = exit_type
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



29
30
31
# File 'lib/rbs/test.rb', line 29

def arguments
  @arguments
end

#exit_typeObject (readonly)

Returns the value of attribute exit_type.



31
32
33
# File 'lib/rbs/test.rb', line 31

def exit_type
  @exit_type
end

#exit_valueObject (readonly)

Returns the value of attribute exit_value.



30
31
32
# File 'lib/rbs/test.rb', line 30

def exit_value
  @exit_value
end

Class Method Details

.break(arguments:) ⇒ Object



47
48
49
# File 'lib/rbs/test.rb', line 47

def self.break(arguments:)
  new(arguments: arguments, exit_value: nil, exit_type: :break)
end

.exception(arguments:, exception:) ⇒ Object



43
44
45
# File 'lib/rbs/test.rb', line 43

def self.exception(arguments:, exception:)
  new(arguments: arguments, exit_value: exception, exit_type: :exception)
end

.return(arguments:, value:) ⇒ Object



39
40
41
# File 'lib/rbs/test.rb', line 39

def self.return(arguments:, value:)
  new(arguments: arguments, exit_value: value, exit_type: :return)
end

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)


69
70
71
# File 'lib/rbs/test.rb', line 69

def break?
  exit_type == :break
end

#exceptionObject



56
57
58
59
# File 'lib/rbs/test.rb', line 56

def exception
  raise unless exit_type == :exception
  exit_value
end

#exception?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/rbs/test.rb', line 65

def exception?
  exit_type == :exception
end

#return?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/rbs/test.rb', line 61

def return?
  exit_type == :return
end

#return_valueObject



51
52
53
54
# File 'lib/rbs/test.rb', line 51

def return_value
  raise unless exit_type == :return
  exit_value
end