Class: Nokaya::Basic
- Inherits:
-
Object
- Object
- Nokaya::Basic
- Defined in:
- lib/nokaya/basic.rb
Direct Known Subclasses
ADN, Apple, Deviantart, Favd, FlickrAlbum, ImageshackUser, ImgurAlbum, Instagram, Movie, Photonet, Tumblr, TumblrAlbum
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#image_url ⇒ Object
Returns the value of attribute image_url.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #get_basic(page) ⇒ Object
-
#initialize(args, options) ⇒ Basic
constructor
A new instance of Basic.
- #parse(url) ⇒ Object
- #save ⇒ Object
Constructor Details
#initialize(args, options) ⇒ Basic
Returns a new instance of Basic.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nokaya/basic.rb', line 9 def initialize args, @options = @workers = Workers.new() @args = @workers.check_args(args) @file_name = [] @image_url = [] @path = @workers.path @type = :basic @name = ['name'] if ['name'] @platform = RbConfig::CONFIG['host_os'] end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
6 7 8 |
# File 'lib/nokaya/basic.rb', line 6 def args @args end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
6 7 8 |
# File 'lib/nokaya/basic.rb', line 6 def file_name @file_name end |
#image_url ⇒ Object
Returns the value of attribute image_url.
7 8 9 |
# File 'lib/nokaya/basic.rb', line 7 def image_url @image_url end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/nokaya/basic.rb', line 6 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/nokaya/basic.rb', line 6 def @options end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/nokaya/basic.rb', line 6 def path @path end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
6 7 8 |
# File 'lib/nokaya/basic.rb', line 6 def type @type end |
Instance Method Details
#get_basic(page) ⇒ Object
21 22 23 |
# File 'lib/nokaya/basic.rb', line 21 def get_basic page page.xpath("//meta[@property='og:image']/@content").first.value end |
#parse(url) ⇒ Object
25 26 27 |
# File 'lib/nokaya/basic.rb', line 25 def parse url Nokogiri::HTML(open url) end |
#save ⇒ Object
29 30 31 |
# File 'lib/nokaya/basic.rb', line 29 def save @workers.save(self) end |