Class: ContentfulMiddleman::Mapper::Base
- Inherits:
-
Object
- Object
- ContentfulMiddleman::Mapper::Base
- Defined in:
- lib/contentful_middleman/mappers/base.rb
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Instance Method Summary collapse
-
#initialize(entries) ⇒ Base
constructor
A new instance of Base.
- #map(context, entry) ⇒ Object
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
#entries ⇒ Object (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 |