Sha256: 96bee800fb5816ed3737ab8b9f68879b7e534ed084c8b778bfad687a16f854c0
Contents?: true
Size: 1.19 KB
Versions: 4
Compression:
Stored size: 1.19 KB
Contents
require 'marcspec/solrfieldspec' module MARCSpec class ConstantSolrSpec < SolrFieldSpec attr_accessor :constantValue #attr_accessor :solrField, :first, :map, :noMapKeyDefault, :marcfieldspecs, :default, :arity def initialize opts = {} @solrField = opts[:solrField] @constantValue = opts[:constantValue] @arity = 1 # Check to make sure we didn't get anything else and warn if need be [:firstOnly, :mapname, :noMapKeyDefault, :specs, :default, :module, :functionSymbol].each do |s| if opts[s] raise ArgumentError, "#{s} is not a valid option for Constant spec (one with :constantValue defined)" end end end def marc_values r, doc = {} return @constantValue end def == other return @constantValue == other.constantValue end def self.fromHash h return self.new(h) end def asPPString s = StringIO.new s.print "{\n :solrField=> " PP.singleline_pp(@solrField, s) s.print(",\n ") s.print ":constantValue => " PP.singleline_pp(@constantValue, s) s.print "\n}" return s.string end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
marcspec-1.5.0 | lib/marcspec/constantspec.rb |
marcspec-1.1.1 | lib/marcspec/constantspec.rb |
marcspec-1.1.0 | lib/marcspec/constantspec.rb |
marcspec-1.0.0 | lib/marcspec/constantspec.rb |