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.



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

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.



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

def arguments
  @arguments
end

#exit_typeObject (readonly)

Returns the value of attribute exit_type.



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

def exit_type
  @exit_type
end

#exit_valueObject (readonly)

Returns the value of attribute exit_value.



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

def exit_value
  @exit_value
end

Class Method Details

.break(arguments:) ⇒ Object



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

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

.exception(arguments:, exception:) ⇒ Object



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

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

.return(arguments:, value:) ⇒ Object



36
37
38
# File 'lib/rbs/test.rb', line 36

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

Instance Method Details

#break?Boolean

Returns:

  • (Boolean)


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

def break?
  exit_type == :break
end

#exceptionObject



53
54
55
56
# File 'lib/rbs/test.rb', line 53

def exception
  raise unless exit_type == :exception
  exit_value
end

#exception?Boolean

Returns:

  • (Boolean)


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

def exception?
  exit_type == :exception
end

#return?Boolean

Returns:

  • (Boolean)


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

def return?
  exit_type == :return
end

#return_valueObject



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

def return_value
  raise unless exit_type == :return
  exit_value
end