module RSpec::Core::MemoizedHelpers

def self.define_helpers_on(example_group)

Other tags:
    Private: -
def self.define_helpers_on(example_group)
  example_group.__send__(:include, module_for(example_group))
end

def self.get_constant_or_yield(example_group, name)

Other tags:
    Private: -
def self.get_constant_or_yield(example_group, name)
  if example_group.const_defined?(name)
    example_group.const_get(name)
  else
    yield
  end
end

def self.get_constant_or_yield(example_group, name)

Other tags:
    Private: -
def self.get_constant_or_yield(example_group, name)
  if example_group.const_defined?(name, (check_ancestors = false))
    example_group.const_get(name, check_ancestors)
  else
    yield
  end
end

def self.module_for(example_group)

Other tags:
    Private: -
def self.module_for(example_group)
  get_constant_or_yield(example_group, :LetDefinitions) do
    mod = Module.new do
      include(Module.new {
        example_group.const_set(:NamedSubjectPreventSuper, self)
      })
    end
    example_group.const_set(:LetDefinitions, mod)
    mod
  end
end

def __init_memoized

Other tags:
    Private: -
def __init_memoized
  @__memoized = if RSpec.configuration.threadsafe?
                  ThreadsafeMemoized.new
                else
                  NonThreadSafeMemoized.new
                end
end

def initialize(*)

Other tags:
    Private: -
def initialize(*)
  __init_memoized
  super
end

def is_expected

Other tags:
    Note: - This only works if you are using rspec-expectations.

Other tags:
    See: #should_not -
    See: #should -
    See: #subject -
def is_expected
  expect(subject)
end

def should(matcher=nil, message=nil)

Other tags:
    Note: - If you are using RSpec's newer expect-based syntax you may
    Note: - This only works if you are using rspec-expectations.

Other tags:
    See: #is_expected -
    See: #subject -
def should(matcher=nil, message=nil)
  RSpec::Expectations::PositiveExpectationHandler.handle_matcher(subject, matcher, message)
end

def should_not(matcher=nil, message=nil)

Other tags:
    Note: - If you are using RSpec's newer expect-based syntax you may
    Note: - This only works if you are using rspec-expectations.

Other tags:
    See: #is_expected -
    See: #subject -
def should_not(matcher=nil, message=nil)
  RSpec::Expectations::NegativeExpectationHandler.handle_matcher(subject, matcher, message)
end

def subject

Other tags:
    See: #is_expected -
    See: #should_not -
    See: #should -

Other tags:
    Note: - Because `subject` is designed to create state that is reset
    Note: - `subject` was contributed by Joe Ferris to support the one-liner
def subject
  __memoized.fetch_or_store(:subject) do
    described = described_class || self.class.metadata.fetch(:description_args).first
    Class === described ? described.new : described
  end
end