class StubRequests::DSL::DefineMethod
Class
DefineMethod
defines helper methods for stubbed endpoints
@author Mikael Henriksson <mikael@zoolutions.se> @since 0.1.4
Attributes
definition[R]
@!attribute [r] definition
@return [MethodDefinition] the method definition
receiver[R]
@!attribute [r] receiver
@return [Module] the receiver of the method definition
Public Class Methods
new(definition, receiver)
click to toggle source
Initialize a new instance of DefineMethod
@param [MethodDefinition] definition the method definition @param [Module] receiver the receiver of the method definition
# File lib/stub_requests/dsl/define_method.rb, line 28 def initialize(definition, receiver) @receiver = receiver @definition = definition end
Public Instance Methods
define()
click to toggle source
Define the {MethodDefinition#to_s} on the receiver
@return [void]
# 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