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

ReVIEW::Chapter and ReVIEW::Part: do not use lazy loading #491

Merged
merged 1 commit into from
Mar 6, 2016

Conversation

takahashim
Copy link
Collaborator

*.re ファイルについて、それに対応するオブジェクトの初期化時に中身を読み込むようにして、それ以降読み込み直さないようにするものです。

また、どうせ読み込んでしまうので、Chapter#open(.reの中身をIOオブジェクトとして返す)はdeprecatedにして、Chapter#content(.reの中身をStringオブジェクトとして返す)を使うようにしたいです(IOが必要な場合はStringIOでラップする)。

  • Chapter.new and Part.new: read file and set @content immediately
  • Compilable#title: use @content instead of self.open
  • Compilable#size: use @content instead of load file.
  • Compilable#open: do not use File.open
  • TOCParser.parse: use Chapter#content instead of Chapter#open

* Chapter.new and Part.new: read file and set @content immediately
* Compilable#title: use @content instead of self.open
* Compilable#size: use @content instead of load file.
* Compilable#open: do not use File.open
* TOCParser.parse: use Chapter#content instead of Chapter#open
@kmuto
Copy link
Owner

kmuto commented Mar 6, 2016

なるほど、挙動としてはこのほうが綺麗そうです。
手持ちの範囲のデータもこれなら影響はなさそうかな。

@takahashim takahashim merged commit 5c3b678 into master Mar 6, 2016
@takahashim takahashim deleted the fix-lazy-loading branch March 6, 2016 14:41
@kdmsnr kdmsnr added this to the 2.0.0 milestone Apr 29, 2016
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

Successfully merging this pull request may close these issues.

3 participants