Sha256: b9ea3af2b2e5ee975555b1d8c847950f4538866701b85f666b0bccc326804265

Contents?: true

Size: 551 Bytes

Versions: 4

Compression:

Stored size: 551 Bytes

Contents

require '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

4 entries across 4 versions & 1 rubygems

Version Path
hairballs-0.1.3 lib/hairballs/plugins/object_ri.rb
hairballs-0.1.2 lib/hairballs/plugins/object_ri.rb
hairballs-0.1.1 lib/hairballs/plugins/object_ri.rb
hairballs-0.1.0 lib/hairballs/plugins/object_ri.rb