Class: Pry::Docmore

Inherits:
Object
  • Object
show all
Defined in:
lib/pry-docmore.rb

Class Method Summary collapse

Class Method Details

.explain(thing) ⇒ Object



28
29
30
31
32
33
34
35
36
# 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) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# 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

.rawObject



27
# File 'lib/pry-docmore.rb', line 27

def self.raw; @DOCS end