module OpenSource::Public

Public Instance Methods

m(obj)
Alias for: open_source
open_source(obj) click to toggle source
# File lib/open_source.rb, line 12
def open_source(obj)
  case obj.class
  when Class, Module
    case obj
    when String
      begin
        Utils.handle_constant! Object.const_get obj
      rescue NameError
        Utils.handle_method_or_name! obj
      end
    when Symbol
      Utils.handle_method_or_name! obj
    when Method, UnboundMethod
      Utils.handle_method_or_name! obj
    else
      Utils.handle_constant! obj
    end
  else
    raise UnopenableError, "Cannot open #{obj.inspect} (#{obj.class}) in an editor"
  end
end
Also aliased as: m