Class: WCC::Contentful::ModelBuilder

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/wcc/contentful/model_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers

#constant_from_content_type, #content_type_from_constant, #content_type_from_raw, #shared_prefix

Constructor Details

#initialize(types, namespace: WCC::Contentful::Model) ⇒ ModelBuilder

Returns a new instance of ModelBuilder.



13
14
15
16
# File 'lib/wcc/contentful/model_builder.rb', line 13

def initialize(types, namespace: WCC::Contentful::Model)
  @types = types
  @namespace = namespace
end

Instance Attribute Details

#namespaceObject (readonly)

Returns the value of attribute namespace.



11
12
13
# File 'lib/wcc/contentful/model_builder.rb', line 11

def namespace
  @namespace
end

Instance Method Details

#build_modelsObject



18
19
20
21
22
# File 'lib/wcc/contentful/model_builder.rb', line 18

def build_models
  @types.each_with_object([]) do |(_k, v), a|
    a << build_model(v)
  end
end