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.



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

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

Instance Attribute Details

#namespaceObject (readonly)

Returns the value of attribute namespace.



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

def namespace
  @namespace
end

Instance Method Details

#build_modelsObject



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

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