Class: RBS::Test::ArgumentsReturn

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ArgumentsReturn.



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

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.



24
25
26
# File 'lib/rbs/test.rb', line 24

def arguments
  @arguments
end

#exit_typeObject (readonly)

Returns the value of attribute exit_type.



26
27
28
# File 'lib/rbs/test.rb', line 26

def exit_type
  @exit_type
end

#exit_valueObject (readonly)

Returns the value of attribute exit_value.



25
26
27
# File 'lib/rbs/test.rb', line 25

def exit_value
  @exit_value
end

Class Method Details

.break(arguments:) ⇒ Object



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

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

.exception(arguments:, exception:) ⇒ Object



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

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

.return(arguments:, value:) ⇒ Object



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

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

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)


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

def break?
  exit_type == :break
end

#exceptionObject



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

def exception
  raise unless exit_type == :exception
  exit_value
end

#exception?Boolean

Returns:

  • (Boolean)


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

def exception?
  exit_type == :exception
end

#return?Boolean

Returns:

  • (Boolean)


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

def return?
  exit_type == :return
end

#return_valueObject



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

def return_value
  raise unless exit_type == :return
  exit_value
end