Class: IMGParser
Instance Attribute Summary collapse
-
#nextParser ⇒ Object
Returns the value of attribute nextParser.
-
#pathPolicy ⇒ Object
Returns the value of attribute pathPolicy.
Instance Method Summary collapse
Methods inherited from Parser
Constructor Details
This class inherits a constructor from Parser
Instance Attribute Details
#nextParser ⇒ Object
Returns the value of attribute nextParser.
10 11 12 |
# File 'lib/Parsers/IMGParser.rb', line 10 def nextParser @nextParser end |
#pathPolicy ⇒ Object
Returns the value of attribute pathPolicy.
10 11 12 |
# File 'lib/Parsers/IMGParser.rb', line 10 def pathPolicy @pathPolicy end |
Instance Method Details
#parse(paragraph) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/Parsers/IMGParser.rb', line 11 def parse(paragraph) if paragraph.type == 'IMG' fileName = paragraph..id #d*fsafwfe.jpg imageURL = "https://miro.medium.com/max/1400/#{paragraph.metadata.id}" imagePathPolicy = PathPolicy.new(pathPolicy.getAbsolutePath(nil), paragraph.postID) absolutePath = imagePathPolicy.getAbsolutePath(fileName) if ImageDownloader.download(absolutePath, imageURL) relativePath = "#{pathPolicy.getRelativePath(nil)}/#{imagePathPolicy.getRelativePath(fileName)}" "" else "" end else if !nextParser.nil? nextParser.parse(paragraph) end end end |