Class: Pry::Docmore

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

Class Method Summary collapse

Class Method Details

.explain(thing) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/pry-docmore.rb', line 27

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



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/pry-docmore.rb', line 5

def self.find_docs pattern
  path = File.dirname(__FILE__) + '/../pry-docmore.wiki/*.md'
  input = Dir[path].map do |file_name|
    if file_name.match pattern
      item = $1
      item.sub! '', '/' # Had to use Unicode "Fraction Slash" in filename.
      [ item, File.read(file_name) ]
    end
  end.compact
  Hash[input]
end

.rawObject



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

def self.raw; @DOCS end