Class: Transpec::Syntax::MethodStub::DeprecatedMethodRecordBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from RecordBuilder

build, #build

Constructor Details

#initialize(method_stub) ⇒ DeprecatedMethodRecordBuilder

Returns a new instance of DeprecatedMethodRecordBuilder.



213
214
215
# File 'lib/transpec/syntax/method_stub.rb', line 213

def initialize(method_stub)
  @method_stub = method_stub
end

Instance Attribute Details

#method_stub ⇒ Object (readonly)

Returns the value of attribute method_stub.



211
212
213
# File 'lib/transpec/syntax/method_stub.rb', line 211

def method_stub
  @method_stub
end

Instance Method Details

#new_syntax ⇒ Object



222
223
224
225
226
# File 'lib/transpec/syntax/method_stub.rb', line 222

def new_syntax
  syntax = 'obj.'
  syntax << method_stub.replacement_for_deprecated_method
  syntax << '(:message)'
end

#old_syntax ⇒ Object



217
218
219
220
# File 'lib/transpec/syntax/method_stub.rb', line 217

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