Class: WCC::Contentful::ModelSingletonMethods::ModelQuery

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/wcc/contentful/model_singleton_methods.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(wrapped_query, options, klass) ⇒ ModelQuery

Returns a new instance of ModelQuery.



89
90
91
92
93
# File 'lib/wcc/contentful/model_singleton_methods.rb', line 89

def initialize(wrapped_query, options, klass)
  @wrapped_query = wrapped_query
  @options = options
  @klass = klass
end

Instance Attribute Details

#klassObject (readonly)



87
88
89
# File 'lib/wcc/contentful/model_singleton_methods.rb', line 87

def klass
  @klass
end

#optionsObject (readonly)



87
88
89
# File 'lib/wcc/contentful/model_singleton_methods.rb', line 87

def options
  @options
end

#wrapped_queryObject (readonly)



87
88
89
# File 'lib/wcc/contentful/model_singleton_methods.rb', line 87

def wrapped_query
  @wrapped_query
end

Instance Method Details

#to_enumObject



95
96
97
98
# File 'lib/wcc/contentful/model_singleton_methods.rb', line 95

def to_enum
  wrapped_query.to_enum
    .map { |r| klass.new(r, options) }
end