class AudioBookCreator::Chapter

Attributes

body[RW]
number[RW]
title[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/audio_book_creator/chapter.rb, line 5
def initialize(options = {})
  options.each { |n, v| public_send("#{n}=", v) }
  @body = Array(body).compact.join("\n\n")
end

Public Instance Methods

==(other) click to toggle source
# File lib/audio_book_creator/chapter.rb, line 26
def ==(other)
  other.kind_of?(Chapter) &&
    other.number == number &&
    other.title.eql?(title) && other.body.eql?(body)
end
Also aliased as: eql?
empty?() click to toggle source
# File lib/audio_book_creator/chapter.rb, line 14
def empty?
  body.empty?
end
eql?(other)
Alias for: ==
filename() click to toggle source
# File lib/audio_book_creator/chapter.rb, line 10
def filename
  format("chapter%02d", number)
end
present?() click to toggle source
# File lib/audio_book_creator/chapter.rb, line 18
def present?
  !empty?
end
to_s() click to toggle source
# File lib/audio_book_creator/chapter.rb, line 22
def to_s
  "#{title}\n\n#{body}\n"
end