<%= book_presenter.author %>
<%= book_presenter.total_price %>
There are no books yet.
<% end %> New book # apps/web/views/books/index.rb module Web::Views::Books class Index include Web::View # SystemStackError (stack level too deep). # def books # books.map{|book| BookPresenter.new(book) } # end def books locals[:books].map{|book| BookPresenter.new(book) } end end end<%= book_presenter.author %>
<%= book_presenter.total_price %>
There are no books yet.
<% end %> New book # lib/bookshelf/presenters /book_presenter.rb require 'hanami/view’ class BookPresenter include Hanami::Presenter attr_reader :book def initialize(book) @book = book end def title book.title end def author book.author end def total_price "税込価格: #{book.total_price.round}円" end end