Sha256: 1affe5ab5ea1b53d42406042cf5840d3e9a0137c10c077fa79c735ffa0817f5d

Contents?: true

Size: 681 Bytes

Versions: 1

Compression:

Stored size: 681 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_link page
      page.xpath("//meta[@property='og:image']/@content").first
    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.2 lib/nokaya/getter.rb