Class: WhatTheGem::Usage::Extractor
- Extended by:
- I::Callable
- Defined in:
- lib/whatthegem/usage/extractor.rb
Overview
TODO: more robustly ignore “installation” section or just remove gem ‘foo’ / gem install -> select only “‘ruby section from markdown (if they exist)? -> more removal patterns? Like `rake something`
Defined Under Namespace
Classes: CodeBlock
Constant Summary collapse
- REMOVE_BLOCKS =
[ %{gem ['"]}, # gem install instructions 'gem install', 'bundle install', 'rake ', 'rails g ', # rails generator 'git clone', # instructions to contribute '\\$', # bash command 'ruby (\S+)$', # run one Ruby command 'Copyright ' # Sometimes they render license in ``` ]
- REMOVE_BLOCKS_RE =
/^#{REMOVE_BLOCKS.join('|')}/
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(file) ⇒ Extractor
constructor
A new instance of Extractor.
Methods included from I::Callable
Constructor Details
#initialize(file) ⇒ Extractor
Returns a new instance of Extractor.
68 69 70 |
# File 'lib/whatthegem/usage/extractor.rb', line 68 def initialize(file) @file = file end |
Class Method Details
.call(file) ⇒ Object
64 65 66 |
# File 'lib/whatthegem/usage/extractor.rb', line 64 def self.call(file) new(file).call end |