Class | Topsy::Page |
In: |
lib/rtopsy/page.rb
|
Parent: | Object |
list | [RW] | |
page | [RW] | |
perpage | [RW] | |
total | [RW] | |
window | [RW] |
creates a Page instance from a hash, setting attributes and a list of Author instances for the page
# File lib/rtopsy/page.rb, line 50 def initialize(hash, content_type) hash.each do |key, value| if key == 'list' if content_type == :author instance_variable_set("@#{key}", get_authors_list(value)) elsif content_type == :link_post instance_variable_set("@#{key}", get_linkposts_list(value)) else instance_variable_set("@#{key}", get_linksearchresult_list(value)) end else instance_variable_set("@#{key}", value) end end end
converts a list of Hash objects into LinkSearchResult objects
# File lib/rtopsy/page.rb, line 40 def get_linksearchresult_list(hash_list) result = [] for hash in hash_list result << LinkSearchResult.new(hash) end return result end