Sha256: becdf0b6a8de685041c8e600eb09132cf30c1c45877a3141b06800310e3ac965

Contents?: true

Size: 745 Bytes

Versions: 5

Compression:

Stored size: 745 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)
    ensure
      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

5 entries across 5 versions & 1 rubygems

Version Path
pry-byetypo-1.3.5 lib/pry-byetypo/setup/application_dictionary.rb
pry-byetypo-1.3.4 lib/pry-byetypo/setup/application_dictionary.rb
pry-byetypo-1.3.3 lib/pry-byetypo/setup/application_dictionary.rb
pry-byetypo-1.3.2 lib/pry-byetypo/setup/application_dictionary.rb
pry-byetypo-1.3.1 lib/pry-byetypo/setup/application_dictionary.rb