Class: SwishE::Result

Inherits:
Object
  • Object
show all
Includes:
SwishEWrapper
Defined in:
lib/swishe.rb

Overview

Class to access the fields in the result set.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#reccountObject

Returns the value of attribute reccount.



48
49
50
# File 'lib/swishe.rb', line 48

def reccount
  @reccount
end

Instance Method Details

#dbfileObject

Return the property “swishdbfile”.



80
81
82
# File 'lib/swishe.rb', line 80

def dbfile
  swish_result_property_str @result, "swishdbfile" 
end

#docpathObject

Return the property “swishdocpath”.



64
65
66
# File 'lib/swishe.rb', line 64

def docpath
  swish_result_property_str(@result,"swishdocpath")
end

#docsizeObject

Return the property “swishdocsize”.



72
73
74
# File 'lib/swishe.rb', line 72

def docsize
  swish_result_property_u_long @result, "swishdocsize"
end

#filenumObject

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

#lastmodifiedObject

Return the property “swishlastmodified”.



84
85
86
# File 'lib/swishe.rb', line 84

def lastmodified
  swish_result_property_str @result, "swishlastmodified" 
end

#rankObject

Return the property “swishrank”.



68
69
70
# File 'lib/swishe.rb', line 68

def rank
  swish_result_property_u_long(@result, "swishrank")
end

#titleObject

Return the property “swishtitle”.



76
77
78
# File 'lib/swishe.rb', line 76

def title
  swish_result_property_str @result, "swishtitle"
end