Class: Ducky::Sources::Gem
- Inherits:
-
Ducky::Source
- Object
- Ducky::Source
- Ducky::Sources::Gem
- Defined in:
- lib/ducky/sources/gem.rb
Instance Method Summary collapse
-
#initialize(name, method, version = :guess) ⇒ Gem
constructor
A new instance of Gem.
- #lookup ⇒ Object
Methods inherited from Ducky::Source
Constructor Details
#initialize(name, method, version = :guess) ⇒ Gem
Returns a new instance of Gem.
5 6 7 8 9 10 11 |
# File 'lib/ducky/sources/gem.rb', line 5 def initialize(name, method, version = :guess) @name = name @method = method @version = version super(method) end |
Instance Method Details
#lookup ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ducky/sources/gem.rb', line 13 def lookup methods = document.css('#method_details .method_details') no_method! unless methods.any? methods.each do |method| method.css('.signature').each do |sig| information[:head] << sig.inner_text.strip end information[:body] = document. css('.docstring .discussion').last information[:footer] = (document.css('.tags').last) information[:source] = document. css('.source_code pre.code').last.inner_text end information rescue Faraday::ResourceNotFound no_method! end |