lib/europeana/blacklight/response.rb in europeana-blacklight-1.2.2 vs lib/europeana/blacklight/response.rb in europeana-blacklight-1.3.0
- old
+ new
@@ -15,11 +15,11 @@
attr_reader :request_params
attr_accessor :document_model, :blacklight_config
def initialize(data, request_params, options = {})
- super(force_to_utf8(data))
+ super(data)
@request_params = request_params
self.document_model = options[:document_model] || Document
self.blacklight_config = options[:blacklight_config]
end
@@ -39,11 +39,11 @@
def sort
params[:sort]
end
def documents
- @documents ||= (self.key?('object') ? [self['object']] : (self['items'] || [])).collect do |doc|
+ @documents ||= (key?('object') ? [self['object']] : (self['items'] || [])).map do |doc|
document_model.new(doc, self)
end
end
alias_method :docs, :documents
@@ -71,23 +71,9 @@
params[:start].to_s.to_i - 1
end
def empty?
total == 0
- end
-
- private
-
- def force_to_utf8(value)
- case value
- when Hash
- value.each { |k, v| value[k] = force_to_utf8(v) }
- when Array
- value.each { |v| force_to_utf8(v) }
- when String
- String.new(value).force_encoding('utf-8') if value.respond_to?(:force_encoding)
- end
- value
end
end
end
end