class Nokaya::Photonet
Public Class Methods
new(args, options = {})
click to toggle source
Calls superclass method
Nokaya::Basic::new
# File lib/nokaya/photonet.rb, line 6 def initialize args, options = {} super(args, options) @type = :photonet parsed = parse(args[0]) @urls = album(parsed) @path = "#{@path}/photonet-#{@workers.timed}" @filenames = name_files() end
Private Instance Methods
album(page)
click to toggle source
# File lib/nokaya/photonet.rb, line 17 def album page return [] if page.nil? refs = page.css('.trp-top a') refs.map do |lin| "http://gallery.photo.net/photo/#{lin['href'].split("=").last}-lg.jpg" end end
name_files()
click to toggle source
# File lib/nokaya/photonet.rb, line 25 def name_files @urls.map do |url| "#{@type.to_s}-#{File.basename(url).gsub('-lg', '')}" end end