lib/endeca/document.rb in endeca-1.3.8 vs lib/endeca/document.rb in endeca-1.4.0
- old
+ new
@@ -5,11 +5,10 @@
#
# The +reader+ declaration provided by Readers can also handle basic data transformations (i.e.
# typecasting) and a few basic examples are provided (i.e. +integer_reader+).
class Document
include Readers
- extend ClassToProc
extend Transformer
inherited_accessor :mappings, {}
inherited_property :path
inherited_property :default_params, {}
@@ -50,11 +49,11 @@
def dimensions
return @dimensions if @dimensions
@dimensions = {}
(raw['Dimensions'] || {}).each do |name, values|
values = [values] unless Array === values
- @dimensions[name] = values.map(&Dimension)
+ @dimensions[name] = values.map{|value| Dimension.new(value)}
end
@dimensions
end
# Find operates with three distinct retrieval approaches:
@@ -85,10 +84,10 @@
# # find first
# Listing.find(:first) # Returns the first Document for the query
# Listing.find(:first, :available => true)
def self.find(what, query_options={})
case what
- when Integer, /^[A-Z\d]+$/
+ when Integer, /^[A-Za-z\d]+$/
by_id(what, query_options)
when String
all(what)
when :first
first(query_options)