Class: Spectus::Challenge
- Inherits:
-
Object
- Object
- Spectus::Challenge
- Defined in:
- lib/spectus/challenge.rb
Overview
This class contains a challenge to apply against an object.
Instance Method Summary collapse
-
#initialize(method, *args) ⇒ Challenge
constructor
Initialize the challenge class.
-
#to(object) ⇒ BasicObject
The result of the challenge.
-
#to_h ⇒ Hash
Properties of the challenge.
Constructor Details
#initialize(method, *args) ⇒ Challenge
Initialize the challenge class.
11 12 13 14 |
# File 'lib/spectus/challenge.rb', line 11 def initialize(method, *args) @method = method.to_sym @args = args end |
Instance Method Details
#to(object) ⇒ BasicObject
Returns The result of the challenge.
19 20 21 |
# File 'lib/spectus/challenge.rb', line 19 def to(object) object.public_send(@method, *@args) end |
#to_h ⇒ Hash
Properties of the challenge.
26 27 28 29 30 31 |
# File 'lib/spectus/challenge.rb', line 26 def to_h { method: @method, args: @args } end |