Sha256: 5d1a3b9565f7802902891d20bb69acb80b6b420549c8543ee5f59d4f58731cd1

Contents?: true

Size: 566 Bytes

Versions: 1

Compression:

Stored size: 566 Bytes

Contents

require_relative '../../hairballs'

# Directly lifted from rbates/dotfiles!  Adds +#ri+ to all Objects, letting you
# get ri docs from within your IRB session.
Hairballs.add_plugin(:object_ri) do |plugin|
  plugin.libraries %w(rdoc)

  plugin.on_load do
    Object.class_eval do
      def ri(method=nil)
        unless method && method =~ /^[A-Z]/ # if class isn't specified
          klass = self.kind_of?(Class) ? name : self.class.name
          method = [klass, method].compact.join('#')
        end

        system 'ri', method.to_s
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hairballs-0.0.1 lib/hairballs/plugins/object_ri.rb