Class: WhatTheGem::Usage

Inherits:
Command show all
Defined in:
lib/whatthegem/usage.rb,
lib/whatthegem/usage/extractor.rb

Overview

TODO use Piotr’s markdown formatter

friendly report of “usage instructions not found”

If gem not found locally – fetch from GitHub

Defined Under Namespace

Classes: Extractor

Constant Summary collapse

TEMPLATE =
Template.parse("{% for u in usage %}\n{{ u.body | rouge }}\n{% endfor %}\n")
README_NOT_FOUND =
I::Pastel.red.bold("Can't find `README` locally or in repo to extract usage.")

Constants inherited from Command

Command::HEADER_TEMPLATE

Instance Attribute Summary

Attributes inherited from Command

#gem

Instance Method Summary collapse

Methods inherited from Command

call, #call, get, #initialize, #meta, register

Constructor Details

This class inherits a constructor from WhatTheGem::Command

Instance Method Details

#localsObject



20
21
22
23
24
# File 'lib/whatthegem/usage.rb', line 20

def locals
  {
    usage: readme.then(&Extractor).first(2).map(&:to_h)
  }
end