Sha256: 1a1ed3f04e83e0a071e1aa205601e0cff492057eba57b29b50aca3e80d9451c8

Contents?: true

Size: 585 Bytes

Versions: 1

Compression:

Stored size: 585 Bytes

Contents

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

module PrySingular
  class << self
    def set_class(*klasses)
      klasses.each(&method(:import_class_command))
    end

    private

    def import_class_command(klass)
      commands = Pry::CommandSet.new do
        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

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pry-singular-0.1.2 lib/pry-singular.rb