class Frasier::Book

Attributes

path[RW]
title[RW]

Public Class Methods

new(path) click to toggle source
# File lib/frasier/book.rb, line 6
def initialize(path)
  raise Errno::ENOENT unless File.exist?(path || "")
  @title = title_from_path(path)
  @path = path
end

Public Instance Methods

dice_word_list() click to toggle source
# File lib/frasier/book.rb, line 12
def dice_word_list
  DiceList.new(File.open(path)).word_list
end

Private Instance Methods

title_from_path(path) click to toggle source
# File lib/frasier/book.rb, line 18
def title_from_path(path)
  File.basename(path).split("_").map(&:capitalize).join(" ")
end