lib/contentful/dynamic_entry.rb in contentful-0.1.0 vs lib/contentful/dynamic_entry.rb in contentful-0.1.1

- old
+ new

@@ -10,30 +10,30 @@ 'Symbol' => :string, 'Integer' => :integer, 'Float' => :float, 'Boolean' => :boolean, 'Date' => :date, - 'Location' => Location, + 'Location' => Location } def self.create(content_type) unless content_type.is_a? ContentType content_type = ContentType.new(content_type) end fields_coercions = Hash[ - content_type.fields.map{ |field| + content_type.fields.map do |field| [field.id.to_sym, KNOWN_TYPES[field.type]] - } + end ] Class.new DynamicEntry do - content_type.fields.each{ |f| + content_type.fields.each do |f| define_method Support.snakify(f.id).to_sym do fields[f.id.to_sym] end - } + end define_singleton_method :fields_coercions do fields_coercions end @@ -49,6 +49,6 @@ "Contentful::DynamicEntry[#{content_type.id}]" end end end end -end \ No newline at end of file +end