module Transpec::Syntax::Mixin::MonkeyPatch

Public Instance Methods

register_syntax_availability_analysis_request(rewriter, key, methods) click to toggle source
# File lib/transpec/syntax/mixin/monkey_patch.rb, line 13
def register_syntax_availability_analysis_request(rewriter, key, methods)
  code = "self.class.ancestors.any? { |a| a.name.start_with?('RSpec::') }"

  methods.each do |method|
    code << " && respond_to?(#{method.inspect})"
  end

  rewriter.register_request(node, key, code, :context)
end
subject_node() click to toggle source
# File lib/transpec/syntax/mixin/monkey_patch.rb, line 31
def subject_node
  receiver_node
end
subject_range() click to toggle source
# File lib/transpec/syntax/mixin/monkey_patch.rb, line 35
def subject_range
  receiver_range
end
syntax_available?(key) click to toggle source
# File lib/transpec/syntax/mixin/monkey_patch.rb, line 23
def syntax_available?(key)
  if runtime_data.present?(node, key)
    runtime_data[node, key]
  else
    static_context_inspector.send(key)
  end
end