Class: Thepub::Epub::NCX::NavPoint

Inherits:
Struct
  • Object
show all
Defined in:
lib/thepub/epub/ncx.rb

Direct Known Subclasses

NavMap

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title, src, points = nil) ⇒ NavPoint

Returns a new instance of NavPoint.



81
82
83
84
85
# File 'lib/thepub/epub/ncx.rb', line 81

def initialize(title, src, points = nil)
  super(title, src)
  @play_order = 0
  @points = points || []
end

Instance Attribute Details

#play_orderObject

Returns the value of attribute play_order.



87
88
89
# File 'lib/thepub/epub/ncx.rb', line 87

def play_order
  @play_order
end

#pointsObject

Returns the value of attribute points.



88
89
90
# File 'lib/thepub/epub/ncx.rb', line 88

def points
  @points
end

#srcObject

Returns the value of attribute src

Returns:

  • (Object)

    the current value of src



76
77
78
# File 'lib/thepub/epub/ncx.rb', line 76

def src
  @src
end

#titleObject

Returns the value of attribute title

Returns:

  • (Object)

    the current value of title



76
77
78
# File 'lib/thepub/epub/ncx.rb', line 76

def title
  @title
end

Instance Method Details

#to_xml(builder) ⇒ Object



90
91
92
93
94
95
96
97
98
# File 'lib/thepub/epub/ncx.rb', line 90

def to_xml(builder)
  builder.navPoint :id => point_id(@play_order), :playOrder => @play_order do
    builder.navLabel do
      builder.text self.title
    end
    builder.content :src => self.src
    @points.each { |point| point.to_xml(builder) }
  end
end