Class: Transpec::Syntax::MethodStub::DeprecatedMethodRecord

Inherits:
Record
  • Object
show all
Defined in:
lib/transpec/syntax/method_stub.rb

Constant Summary

Constants inherited from Record

Record::OVERRIDDE_FORBIDDEN_METHODS

Instance Attribute Summary

Attributes inherited from Record

#annotation, #converted_syntax_type, #original_syntax_type

Instance Method Summary collapse

Methods inherited from Record

#==, #converted_syntax, #hash, #original_syntax, #to_s

Constructor Details

#initialize(method_stub) ⇒ DeprecatedMethodRecord

Returns a new instance of DeprecatedMethodRecord.



221
222
223
# File 'lib/transpec/syntax/method_stub.rb', line 221

def initialize(method_stub, *)
  @method_stub = method_stub
end

Instance Method Details

#build_converted_syntaxObject



230
231
232
233
234
# File 'lib/transpec/syntax/method_stub.rb', line 230

def build_converted_syntax
  syntax = 'obj.'
  syntax << @method_stub.send(:replacement_method_for_deprecated_method)
  syntax << '(:message)'
end

#build_original_syntaxObject



225
226
227
228
# File 'lib/transpec/syntax/method_stub.rb', line 225

def build_original_syntax
  syntax = @method_stub.any_instance? ? 'Klass.any_instance' : 'obj'
  syntax << ".#{@method_stub.method_name}(:message)"
end