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.
13 14 15 16 |
# File 'lib/defi/challenge.rb', line 13 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.
23 24 25 |
# File 'lib/defi/challenge.rb', line 23 def to(object) object.public_send(@method, *@args) end |
#to_h ⇒ Hash
Properties of the challenge.
32 33 34 35 36 37 |
# File 'lib/defi/challenge.rb', line 32 def to_h { method: @method, args: @args } end |