Sha256: 7001ae6376a481e07ac7c2a7fbd26c517223f3f2f85a40943701be5e9edf0fde

Contents?: true

Size: 661 Bytes

Versions: 2

Compression:

Stored size: 661 Bytes

Contents

# encoding: utf-8
module Nokaya

  class ADN < Basic

    attr_reader :author

    def initialize args, options = {}
      super(args, options)
      @type = :adn
      parsed = parse(args[0])
      @urls = [get_basic(parsed)].compact
      @author = author(parsed)
      @filenames = name_files()
    end

    private

    def author page
      page.css('.p-nickname')[0].text unless page.nil?
    end

    def post_id args
      /\d+{2}/.match(args[0])
    end

    def name_files
      unless @urls.empty?
        @name ||= @workers.sanitize(@author)
        ["#{@type.to_s}-#{@name}-#{post_id(args)}.jpg"]
      else
        []
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
nokaya-0.1.4 lib/nokaya/adn.rb
nokaya-0.1.3 lib/nokaya/adn.rb