Class: SwishE::Result
Overview
Class to access the fields in the result set.
Instance Attribute Summary collapse
-
#reccount ⇒ Object
Returns the value of attribute reccount.
Instance Method Summary collapse
-
#dbfile ⇒ Object
Return the property “swishdbfile”.
-
#docpath ⇒ Object
Return the property “swishdocpath”.
-
#docsize ⇒ Object
Return the property “swishdocsize”.
-
#filenum ⇒ Object
Return the property “swishreccount”.
-
#initialize(result) ⇒ Result
constructor
A new instance of Result.
-
#lastmodified ⇒ Object
Return the property “swishlastmodified”.
-
#method_missing(meth) ⇒ Object
Dynamically return the result based on the name of method.
-
#rank ⇒ Object
Return the property “swishrank”.
-
#title ⇒ Object
Return the property “swishtitle”.
Constructor Details
#initialize(result) ⇒ Result
Returns a new instance of Result.
50 51 52 53 54 55 56 57 |
# File 'lib/swishe.rb', line 50 def initialize(result) @result=result # There seems to be a bug which I can't locate: reccount looks like a global variable. # It defaults to the max count of the results. So I query this property before going to the # next record. This is perhaps just a workaround. See # http://rubyforge.org/tracker/index.php?func=detail&aid=8630&group_id=2688&atid=10339 @reccount=swish_result_property_u_long @result, "swishreccount" end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth) ⇒ Object
Dynamically return the result based on the name of method. For example, calling Result#foo tries to get the property name ‘foo’ from swish-e.
60 61 62 |
# File 'lib/swishe.rb', line 60 def method_missing(meth) swish_result_property_str(@result,meth.to_s) end |
Instance Attribute Details
#reccount ⇒ Object
Returns the value of attribute reccount.
48 49 50 |
# File 'lib/swishe.rb', line 48 def reccount @reccount end |
Instance Method Details
#dbfile ⇒ Object
Return the property “swishdbfile”.
80 81 82 |
# File 'lib/swishe.rb', line 80 def dbfile swish_result_property_str @result, "swishdbfile" end |
#docpath ⇒ Object
Return the property “swishdocpath”.
64 65 66 |
# File 'lib/swishe.rb', line 64 def docpath swish_result_property_str(@result,"swishdocpath") end |
#docsize ⇒ Object
Return the property “swishdocsize”.
72 73 74 |
# File 'lib/swishe.rb', line 72 def docsize swish_result_property_u_long @result, "swishdocsize" end |
#filenum ⇒ Object
Return the property “swishreccount”. def reccount
swish_result_property_u_long @result, "swishreccount"
end Return the property “swishfilenum”.
92 93 94 |
# File 'lib/swishe.rb', line 92 def filenum swish_result_property_u_long @result, "swishfilenum" end |
#lastmodified ⇒ Object
Return the property “swishlastmodified”.
84 85 86 |
# File 'lib/swishe.rb', line 84 def lastmodified swish_result_property_str @result, "swishlastmodified" end |
#rank ⇒ Object
Return the property “swishrank”.
68 69 70 |
# File 'lib/swishe.rb', line 68 def rank swish_result_property_u_long(@result, "swishrank") end |
#title ⇒ Object
Return the property “swishtitle”.
76 77 78 |
# File 'lib/swishe.rb', line 76 def title swish_result_property_str @result, "swishtitle" end |