Sha256: d9ba92ae4f08253e53fb5562db3d4726c6bbb7d94e80a783bd1aeb30f220067b

Contents?: true

Size: 675 Bytes

Versions: 1

Compression:

Stored size: 675 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.2 lib/nokaya/deviantart.rb