Class: NyaaSearch
- Inherits:
-
Object
- Object
- NyaaSearch
- Defined in:
- lib/nyaa_search.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#filter ⇒ Object
Returns the value of attribute filter.
-
#page ⇒ Object
Returns the value of attribute page.
-
#query ⇒ Object
Returns the value of attribute query.
-
#submitter ⇒ Object
Returns the value of attribute submitter.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ NyaaSearch
constructor
A new instance of NyaaSearch.
- #querystring ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ NyaaSearch
Returns a new instance of NyaaSearch.
25 26 27 28 29 30 31 |
# File 'lib/nyaa_search.rb', line 25 def initialize(args={}) self.filter = args[:filter] || Nyaa::Filter::NoFilter self.category = args[:category] || Nyaa::Category::AllCategories self.query = args[:query] || "" self.submitter = args[:submitter] || nil self.page = args[:page] || 1 end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
23 24 25 |
# File 'lib/nyaa_search.rb', line 23 def category @category end |
#filter ⇒ Object
Returns the value of attribute filter.
23 24 25 |
# File 'lib/nyaa_search.rb', line 23 def filter @filter end |
#page ⇒ Object
Returns the value of attribute page.
23 24 25 |
# File 'lib/nyaa_search.rb', line 23 def page @page end |
#query ⇒ Object
Returns the value of attribute query.
23 24 25 |
# File 'lib/nyaa_search.rb', line 23 def query @query end |
#submitter ⇒ Object
Returns the value of attribute submitter.
23 24 25 |
# File 'lib/nyaa_search.rb', line 23 def submitter @submitter end |
Instance Method Details
#querystring ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/nyaa_search.rb', line 33 def querystring form = { "f" => self.filter, "c" => self.category, "q" => self.query, "p" => self.page, "u" => self.submitter, } URI.encode_www_form(form.compact) end |