Class: WCC::Contentful::Store::Base::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/wcc/contentful/store/base.rb

Instance Method Summary collapse

Instance Method Details

#apply(filter, context = nil) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/wcc/contentful/store/base.rb', line 76

def apply(filter, context = nil)
  filter.reduce(self) do |query, (field, value)|
    if value.is_a?(Hash)
      k = value.keys.first
      raise ArgumentError, "Filter not implemented: #{value}" unless query.respond_to?(k)
      query.public_send(k, field, value[k], context)
    else
      query.eq(field.to_s, value)
    end
  end
end

#resultObject

Raises:

  • (NotImplementedError)


72
73
74
# File 'lib/wcc/contentful/store/base.rb', line 72

def result
  raise NotImplementedError
end