Skip to content

Commit

Permalink
Define classes instead of overriding const_missing
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcolvar committed Nov 10, 2015
1 parent b045407 commit cf4bf7b
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions lib/blacklight.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,20 @@ class << self
attr_accessor :solr, :solr_config
end

# For deprecating SolrRepository and SolrResponse
def self.const_missing(const_name)
case const_name
when :SolrRepository
Deprecation.warn(:SolrRepository, 'Blacklight::SolrRepository is deprecated; use Blacklight::Solr::Repository instead')
Solr::Repository
when :SolrResponse
Deprecation.warn(:SolrResponse, 'Blacklight::SolrResponse is deprecated; use Blacklight::Solr::Response instead')
Solr::Response
else
class SolrRepository < Solr::Repository
extend Deprecation
def initialize blacklight_config
Deprecation.warn(self, 'Blacklight::SolrRepository is deprecated; use Blacklight::Solr::Repository instead')
super
end
end
end

class SolrResponse < Solr::Response
extend Deprecation
def initialize(data, request_params, options = {})
Deprecation.warn(self, 'Blacklight::SolrResponse is deprecated; use Blacklight::Solr::Response instead')
super
end
end

# Secret key used to share session information with
Expand Down

0 comments on commit cf4bf7b

Please sign in to comment.