Sha256: c02aaf6779617aa3569fbe37433a80432b2c1b0ce0eae4f55e71b1676a720c1c

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

# encoding: utf-8
module Nokaya

  class Deviantart < Basic

    def initialize args, options
      super(args, options)
      @type = :deviantart
      parsed = self.parse(args[0])
      @image_url = album(parsed).compact
      @author = author()
      @path = "#{@path}/deviantart-#{@author}-#{@workers.timed}"
      @file_name = name()
    end

    private

    def author
      @workers.sanitize(@args[0].split('.com/')[1].chomp('/'))
    end

    def album page
      refs = page.css('a.thumb')
      refs.map {|li| li['data-super-img']}
    end

    def name
      @image_url.map do |url|
        "#{@type.to_s}-#{File.basename(url)}"
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nokaya-0.1.1 lib/nokaya/deviantart.rb