Sha256: 95d3b31dedbfc2beedf36f92c35649a4da73b20750882611cd954a0651ea715c

Contents?: true

Size: 530 Bytes

Versions: 2

Compression:

Stored size: 530 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

2 entries across 2 versions & 1 rubygems

Version Path
epubber-0.2.0 lib/epubber/models/chapter.rb
epubber-0.1.3 lib/epubber/models/chapter.rb