Class: ContentfulMiddleman::Mapper::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/contentful_middleman/mappers/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entries) ⇒ Base

Returns a new instance of Base.



8
9
10
# File 'lib/contentful_middleman/mappers/base.rb', line 8

def initialize(entries)
  @entries = entries
end

Instance Attribute Details

#entriesObject (readonly)

Returns the value of attribute entries.



6
7
8
# File 'lib/contentful_middleman/mappers/base.rb', line 6

def entries
  @entries
end

Instance Method Details

#map(context, entry) ⇒ Object



12
13
14
15
# File 'lib/contentful_middleman/mappers/base.rb', line 12

def map(context, entry)
  context.id = entry.id
  entry.fields.each {|k, v| map_field context, k, v}
end