Sha256: ec2beeaef11a74fa5f46737daa23b1148f3fa9aefb95c1c5cccc97b94ff5eafc

Contents?: true

Size: 629 Bytes

Versions: 1

Compression:

Stored size: 629 Bytes

Contents

# encoding: utf-8
module Nokaya
  class ADN < Basic

    attr_reader :author

    def initialize args, options
      super(args, options)
      @type = :adn
      parsed = self.parse(args[0])
      @image_url = [self.get_basic(parsed)]
      @author = author(parsed)
      @file_name = [name()]
    end

    private

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

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

    def name
      unless @name.nil?
        "#{@type.to_s}-#{@name}"
      else
        "#{@type.to_s}-#{@workers.sanitize(@author)}-#{post_id(args)}.jpg"
      end
    end

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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