Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catalog.ymlで「CHAPS:」がnullのとき、rake pdfがエラー #1273

Closed
kauplan opened this issue Feb 27, 2019 · 1 comment
Closed

catalog.ymlで「CHAPS:」がnullのとき、rake pdfがエラー #1273

kauplan opened this issue Feb 27, 2019 · 1 comment

Comments

@kauplan
Copy link

kauplan commented Feb 27, 2019

問題点

catalog.ymlにおいて「CHAPS:」がnullだと、rake pdfがエラーになる。

$ rake pdf
review-pdfmaker config.yml
/tmp/review3/gems/gems/review-3.0.0/lib/review/book/base.rb:321:in `parse_chapters': undefined method `map' for "":String (NoMethodError)
Did you mean?  tap
...(以下略)...

原因

「CHAPS:」がnullのとき、ReVIEW::Catalog#parts_with_chaps()が空配列ではなく空文字列を返しているのが原因。

module ReVIEW
  class Catalog
    def parts_with_chaps
      return '' unless @yaml['CHAPS']  # ← 配列を返すべきなのに文字列を返している
      @yaml['CHAPS'].flatten.compact
    end
  end
end

修正方法

ReVIEW::Catalog#parts_with_chaps()が空配列を返すように修正する。

module ReVIEW
  class Catalog
    def parts_with_chaps
      (@yaml['CHAPS'] || []).flatten.compact
    end
  end
end

バージョン

Re:VIEW 2.5, 3.0

@kmuto
Copy link
Owner

kmuto commented Feb 28, 2019

ありがとうございます、#1274 で修正予定です。

kmuto added a commit that referenced this issue Feb 28, 2019
takahashim pushed a commit that referenced this issue Feb 28, 2019
* merge #1226
* merge #1228
* update NEWS
* add #1268
* add #1267
* fix #1273
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants