lib/wcc/contentful/middleware/store.rb in wcc-contentful-1.2.0 vs lib/wcc/contentful/middleware/store.rb in wcc-contentful-1.2.1
- old
+ new
@@ -94,13 +94,13 @@
# by default all enumerable methods delegated to the to_enum method
delegate(*(Enumerable.instance_methods - Module.instance_methods), to: :to_enum)
def count
if middleware.has_select?
- raise NameError, "Count cannot be determined because the middleware '#{middleware}'" \
- " implements the #select? method. Please use '.to_a.count' to count entries that" \
- ' pass the #select? method.'
+ raise NameError, "Count cannot be determined because the middleware '#{middleware}' " \
+ "implements the #select? method. Please use '.to_a.count' to count entries that " \
+ 'pass the #select? method.'
end
# The wrapped query may get count from the "Total" field in the response,
# or apply a "COUNT(*)" to the query.
wrapped_query.count
@@ -110,12 +110,10 @@
def to_enum
result = wrapped_query.to_enum
result = result.select { |x| middleware.select?(x) } if middleware.has_select?
- if options && options[:include]
- result = result.map { |x| middleware.resolve_includes(x, options[:include]) }
- end
+ result = result.map { |x| middleware.resolve_includes(x, options[:include]) } if options && options[:include]
result.map { |x| middleware.transform(x) }
end
def apply(filter, context = nil)