lib/marcspec/customspec.rb in marcspec-0.7.1 vs lib/marcspec/customspec.rb in marcspec-0.7.2
- old
+ new
@@ -30,11 +30,11 @@
#
class CustomSolrSpec < SolrFieldSpec
- attr_accessor :module, :functionSymbol, :methodArgs
+ attr_accessor :module, :functionSymbol, :functionArgs
# Get a new Custom Solr Spec based on the passed in options.
# @param [Hash] opts Initialization options
# @option opts [String, Array<String>] :solrField the name(s) of the Solr field(s) that will receive the data derived from this spec
# @option opts [Module] :module the actual module constant (not a string or symbol representation) which holds the
@@ -56,11 +56,11 @@
unless @solrField and @module and @functionSymbol
raise ArgumentError, "Custom solr spec must have a field name in :solrField, module in :module, and the method name as a symbol in :functionSymbol"
end
- @methodArgs = opts[:methodArgs] || []
+ @functionArgs = opts[:functionArgs] || []
@first = opts[:firstOnly] || false
@default = opts[:default] || nil
@map = opts[:map] || nil
@noMapKeyDefault = opts[:noMapKeyDefault] || nil
@@ -84,11 +84,11 @@
# @param [MARC4J4R::Record] r A marc record
# @param [SolrInputDocument, Hash] doc The document we're constructing.
# @return [Array<String>] An array of values returned by the custom method
def raw_marc_values r, doc
- return @module.send(@functionSymbol, doc, r, *@methodArgs)
+ return @module.send(@functionSymbol, doc, r, *@functionArgs)
end
def self.fromHash h
return self.new(h)
@@ -119,12 +119,12 @@
s.print(":module => ")
PP.singleline_pp(@module, s)
s.print(",\n :functionSymbol => ")
PP.singleline_pp(@functionSymbol, s)
- if @methodArgs
- s.print(",\n :methodArgs => ")
- PP.singleline_pp(@methodArgs, s)
+ if @functionArgs
+ s.print(",\n :functionArgs => ")
+ PP.singleline_pp(@functionArgs, s)
end
s.print "\n}"
return s.string
end
\ No newline at end of file