class Nokaya::Favd
Attributes
Public Class Methods
new(args, options = {})
click to toggle source
Calls superclass method
Nokaya::Basic::new
# File lib/nokaya/favd.rb, line 8 def initialize args, options = {} super(args, options) url = if options[:post] "http://pic.favd.net/#{args[0]}" else args[0] end @type = :favd parsed = parse(url) @urls = get_favd(parsed).compact @author = author_name(parsed) @filenames = name_files() end
Private Instance Methods
get_favd(page)
click to toggle source
# File lib/nokaya/favd.rb, line 29 def get_favd page img = page.css('#largeImage') img.empty? ? [] : [img[0]['src']] end
name_files()
click to toggle source
# File lib/nokaya/favd.rb, line 34 def name_files unless @urls.empty? @name ||= @workers.sanitize(@author) ["#{@type.to_s}-#{@name}-#{@workers.timed}.jpg"] else [] end end