Sha256: 5b3de955299ccf0afefcd699915e57ca5e7e36ac239bb5f0118de70de71e3728

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true

require_relative "../base"
require_relative "store"
require_relative "dictionary/active_record"
require "pstore"

module Setup
  class ApplicationDictionary < Base
    include Store

    def initialize(binding)
      @binding = binding
    end

    def call
      Setup::Dictionary::ActiveRecord.initialize! if defined?(ActiveRecord)
      populate_store
    end

    private

    attr_reader :binding

    def populate_store
      # Create a table with unique instance identifier information to store variables history.
      store.transaction { store[pry_instance_uid] = [] }
    end

    # Use the binding identifier as pry instance uid.
    def pry_instance_uid
      binding.to_s
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pry-byetypo-1.3.0 lib/pry-byetypo/setup/application_dictionary.rb
pry-byetypo-1.2.0 lib/pry-byetypo/setup/application_dictionary.rb