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.



46
47
48
49
50
51
52
53
# File 'lib/swishe.rb', line 46

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.



56
57
58
# File 'lib/swishe.rb', line 56

def method_missing(meth)
  swish_result_property_str(@result,meth.to_s) 
end

Instance Attribute Details

#reccountObject

Returns the value of attribute reccount.



44
45
46
# File 'lib/swishe.rb', line 44

def reccount
  @reccount
end

Instance Method Details

#dbfileObject

Return the property “swishdbfile”.



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

def dbfile
  swish_result_property_str @result, "swishdbfile" 
end

#docpathObject

Return the property “swishdocpath”.



60
61
62
# File 'lib/swishe.rb', line 60

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

#docsizeObject

Return the property “swishdocsize”.



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

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”.



88
89
90
# File 'lib/swishe.rb', line 88

def filenum
  swish_result_property_u_long  @result, "swishfilenum" 
end

#lastmodifiedObject

Return the property “swishlastmodified”.



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

def lastmodified
  swish_result_property_str @result, "swishlastmodified" 
end

#rankObject

Return the property “swishrank”.



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

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

#titleObject

Return the property “swishtitle”.



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

def title
  swish_result_property_str @result, "swishtitle"
end