Sha256: 85af4c10e5d8e9423bc46d866cb5837ee66f7ab631659eb7b1e860d0fb6757c2

Contents?: true

Size: 671 Bytes

Versions: 1

Compression:

Stored size: 671 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_name(parsed)
      @filenames = name_files()
    end

    private

    def author_name 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

1 entries across 1 versions & 1 rubygems

Version Path
nokaya-0.1.5 lib/nokaya/adn.rb