Class: StubRequests::DSL::DefineMethod
- Defined in:
- lib/stub_requests/dsl/define_method.rb
Overview
Class DefineMethod defines helper methods for stubbed endpoints
Instance Attribute Summary collapse
- #definition ⇒ Object readonly
- #receiver ⇒ Object readonly
Instance Method Summary collapse
-
#define ⇒ void
Define the MethodDefinition#to_s on the receiver.
-
#initialize(definition, receiver) ⇒ DefineMethod
constructor
Initialize a new instance of DefineMethod.
Constructor Details
#initialize(definition, receiver) ⇒ DefineMethod
Initialize a new instance of DefineMethod
28 29 30 31 |
# File 'lib/stub_requests/dsl/define_method.rb', line 28 def initialize(definition, receiver) @receiver = receiver @definition = definition end |
Instance Attribute Details
#definition ⇒ Object (readonly)
15 16 17 |
# File 'lib/stub_requests/dsl/define_method.rb', line 15 def definition @definition end |
#receiver ⇒ Object (readonly)
19 20 21 |
# File 'lib/stub_requests/dsl/define_method.rb', line 19 def receiver @receiver end |
Instance Method Details
#define ⇒ void
This method returns an undefined value.
Define the MethodDefinition#to_s on the receiver
39 40 41 42 43 44 45 46 |
# File 'lib/stub_requests/dsl/define_method.rb', line 39 def define Docile.dsl_eval(receiver) do silence_redefinition_of_method(definition.name) module_eval <<~METHOD, __FILE__, __LINE__ + 1 #{definition} METHOD end end |