class Epuber::NavFile::NavItem
Attributes
@return [Array<NavItem>]
@return [String]
@return [String]
Public Class Methods
Source
# File lib/epuber/from_file/nav_file.rb, line 16 def initialize(href, title) @href = href @title = title @children = [] end
@param [String] href @param [String] title
Public Instance Methods
Source
# File lib/epuber/from_file/nav_file.rb, line 27 def find_by_href(other_href, ignore_fragment: false) if ignore_fragment other_href = other_href.split('#').first self_href = @href.split('#').first return self if self_href == other_href elsif @href == other_href return self end @children.find { |item| item.find_by_href(other_href) } end
@param [String] other_href @param [Boolean] ignore_fragment
@return [NavItem, nil]