Class: PryDocNotebook::YRI

Inherits:
YARD::CLI::YRI
  • Object
show all
Defined in:
lib/pry-doc-notebook/yri.rb

Constant Summary collapse

USAGE =
<<~USAGE
  Usage: ? <Path to object>
  Example: ? String#gsub
USAGE

Instance Method Summary collapse

Instance Method Details

#display(name) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/pry-doc-notebook/yri.rb', line 13

def display(name)
  if name.nil? || name.strip.empty?
    puts USAGE
    return nil
  end

  object = find_object(name)
  if object
    IRuby.display object.format(format: :html), mime: 'text/html'
  else
    puts "No documentation for `#{name}'"
  end
  return nil
end