Sha256: c506b4c9aff8e425f991b6fa8ca61e2e52a2c440d2205aed7477e0dbc5dfd8d7

Contents?: true

Size: 531 Bytes

Versions: 1

Compression:

Stored size: 531 Bytes

Contents

require 'epubber/models/concerns/has_html'

# Represents a book's chapter
module Epubber::Models
  class Chapter
    include Epubber::Models::Concerns::HasHTML

    def initialize
      @id = 0
      @title = 'Not specified'
      @content = '<p>Not specified</p>'
    end

    def id(idx)
      @id = idx
    end

    def title(text)
      @title = text
    end

    def content(text)
      @content = clean_html(text()
    end

    def contextify
      { 'id' => @id, 'title' => @title, 'content' => @content }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
epubber-0.1.2 lib/epubber/models/chapter.rb