class Pry::Docmore

Public Class Methods

explain(thing) click to toggle source
# File lib/pry-docmore.rb, line 28
def self.explain thing
  @DOCS.each do |label, docs|
    # TODO: URL for each
    if explanation = docs[:explanations][thing]
      return Pry::Helpers::Text.yellow(thing) + $/ + explanation
    end
  end
  nil
end
find_docs(pattern) click to toggle source
# File lib/pry-docmore.rb, line 6
def self.find_docs pattern
  docs = YAML.load_file File.dirname(__FILE__) + '/../docmores.yaml'
  input = docs.map do |k,v|
    if k.match pattern
      item = $1
      item.sub! '⁄', '/' # Had to use Unicode "Fraction Slash" in filename.
      [ item, v ]
    end
  end.compact
  Hash[input.sort]
end
raw() click to toggle source
# File lib/pry-docmore.rb, line 27
def self.raw; @DOCS end

Public Instance Methods

process(arg_string) click to toggle source
# File lib/pry-docmore.rb, line 44
def process arg_string
  if docmore = Pry::Docmore.explain(arg_string)
    _pry_.output.puts docmore
  else
    ORIGINAL_SHOW_DOC.new(context).call_safely(arg_string)
  end
end