Sha256: f1297d873e01594f328c4e27b7ff1ebe06583b59bd50840ca7a546712f0ecc72

Contents?: true

Size: 630 Bytes

Versions: 2

Compression:

Stored size: 630 Bytes

Contents

require "pry-singular/version"
require 'pry'

module PrySingular
  class << self
    def set_class(*klasses)
      import_class_command(klasses)
    end

    private

    def import_class_command(klasses)
      commands = Pry::CommandSet.new do
        klasses.each do |klass|
          klass.public_methods.each do |klass_method|
            command "#{klass_method}", "#{klass}.#{klass_method}" do
              klass.class_eval <<-EOS
                #{Readline::HISTORY.to_a.last.gsub(' ', '')}
              EOS
            end
          end
        end
      end

      Pry.config.commands.import(commands)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pry-singular-0.1.1 lib/pry-singular.rb
pry-singular-0.1.0 lib/pry-singular.rb