class Epuber::BookspecGenerator::TocItem
Attributes
children[RW]
@return [Array<TocItem>]
href[RW]
@return [String]
landmarks[RW]
@return [Array<Symbol>]
title[RW]
@return [String, nil]
Public Class Methods
new(href, title = nil, landmarks = [], children = [])
click to toggle source
# File lib/epuber/from_file/bookspec_generator.rb, line 24 def initialize(href, title = nil, landmarks = [], children = []) @href = href @title = title @landmarks = landmarks @children = children end
Public Instance Methods
==(other)
click to toggle source
# File lib/epuber/from_file/bookspec_generator.rb, line 35 def ==(other) other.is_a?(TocItem) && href == other.href && title == other.title && landmarks == other.landmarks && children == other.children end
attribs()
click to toggle source
# File lib/epuber/from_file/bookspec_generator.rb, line 31 def attribs [href.inspect, title&.inspect, *landmarks.map(&:inspect)].compact.join(', ') end
inspect()
click to toggle source
# File lib/epuber/from_file/bookspec_generator.rb, line 49 def inspect %(#<#{self.class.name} #{self}>) end
to_s(level = 0)
click to toggle source
# File lib/epuber/from_file/bookspec_generator.rb, line 43 def to_s(level = 0) indent = ' ' * level children_str = children.map { |c| c.to_s(level + 2) }.join("\n") %(#{indent}#{href.inspect} #{title.inspect} #{landmarks.inspect}\n#{children_str}) end