Sha256: de9b7bd5c5e4591043e36ae6583a96d1d9f141e9bc320454b954b65a5c6af402

Contents?: true

Size: 752 Bytes

Versions: 1

Compression:

Stored size: 752 Bytes

Contents

# encoding: utf-8
module Nokaya
  class Getter
    def initialize *args
      @args = OpenStruct.new options: args[0], type: args[1], url: args[2][0]
    end
    def args
      @args.inspect
    end
    def options
      @args.options
    end
    def type
      @args.type
    end
    def url
      @args.url
    end
    def get_image img_link
      begin
        open(img_link).read
      rescue
        abort Status.no_can_do
      end
    end
    def get_basic page
      page.xpath("//meta[@property='og:image']/@content").first
    end
    def get_favd page
      page.css('#largeImage')[0]['src']
    end
    def parse_page
      Nokogiri::HTML get_page_content
    end
    private
    def get_page_content
      open @args.url
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nokaya-0.0.3 lib/nokaya/getter.rb