2020-05-01から1日間の記事一覧
class HogePostsEntity attr_reader :author, :comments def initialize(post) @author = post.author @comments = post.comments end def self.collection(posts) posts.map { |post| new(post) } end end こんな感じでシンプルにEntity用のクラスを作れた…
class HogePostsEntity attr_reader :author, :comments def initialize(post) @author = post.author @comments = post.comments end def self.collection(posts) posts.map { |post| new(post) } end end こんな感じでシンプルにEntity用のクラスを作れた…