Class: Obp::Access::Imager
- Inherits:
-
Object
- Object
- Obp::Access::Imager
- Defined in:
- lib/obp/access/imager.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#html ⇒ Object
readonly
Returns the value of attribute html.
Instance Method Summary collapse
- #images ⇒ Object
-
#initialize(html:, directory:) ⇒ Imager
constructor
A new instance of Imager.
Constructor Details
#initialize(html:, directory:) ⇒ Imager
Returns a new instance of Imager.
6 7 8 9 |
# File 'lib/obp/access/imager.rb', line 6 def initialize(html:, directory:) @html = html @directory = directory end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
4 5 6 |
# File 'lib/obp/access/imager.rb', line 4 def directory @directory end |
#html ⇒ Object (readonly)
Returns the value of attribute html.
4 5 6 |
# File 'lib/obp/access/imager.rb', line 4 def html @html end |
Instance Method Details
#images ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/obp/access/imager.rb', line 11 def images doc = Nokogiri::HTML(html) images = doc.search("div.sts-fig > img").to_h do |img| key = img.attr("src") path = File.join(imgdir, key.split("/").last) [key, path] end download_images(images) images end |