Class: Defi::Challenge Private
- Inherits:
-
Object
- Object
- Defi::Challenge
- Defined in:
- lib/defi/challenge.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
This class contains a challenge to apply against an object.
Instance Method Summary collapse
-
#initialize(method, *args) ⇒ Challenge
constructor
private
Initialize the challenge class.
-
#to(object) ⇒ #object_id
The actual value, or a raised exception.
-
#to_h ⇒ Hash
Properties of the challenge.
Constructor Details
#initialize(method, *args) ⇒ Challenge
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initialize the challenge class.
15 16 17 18 |
# File 'lib/defi/challenge.rb', line 15 def initialize(method, *args) @method = method.to_sym @args = args end |
Instance Method Details
#to(object) ⇒ #object_id
Returns The actual value, or a raised exception.
25 26 27 |
# File 'lib/defi/challenge.rb', line 25 def to(object) object.public_send(@method, *@args) end |
#to_h ⇒ Hash
Properties of the challenge.
34 35 36 37 38 39 |
# File 'lib/defi/challenge.rb', line 34 def to_h { method: @method, args: @args } end |