File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,12 @@ class Entries
88
99 def initialize ( body )
1010 @body = body
11- @entries = body . map { |entry | Entry . new ( entry ) }
1211 end
1312
1413 def each ( &block )
15- entries . each ( &block )
14+ @body . each do |entry |
15+ block . call ( Entry . new ( entry ) )
16+ end
1617 end
1718 end
1819end
Original file line number Diff line number Diff line change 22
33module Contentstack
44 class Entry
5+
6+ attr_reader :properties , :attributes
57
68 def initialize ( attributes )
79 @attributes = attributes
10+ @properties = attributes . keys
11+
12+ properties . each do |prop |
13+ define_singleton_method prop do
14+ @attributes [ prop ]
15+ end
16+ end
817 end
918
10- def properties
11- @ attributes. keys
19+ def to_s
20+ " #{ attributes [ :title ] } created on #{ attributes [ :created_at ] } "
1221 end
1322
1423 def is_entry?
You can’t perform that action at this time.
0 commit comments