Method: GEPUB::Metadata#title

Defined in:
lib/gepub/metadata.rb

#title(content = UNASSIGNED, id: nil, title_type: nil) ⇒ Object



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/gepub/metadata.rb', line 135

def title(content=UNASSIGNED, id: nil, title_type: nil)
  if unassigned?(content)
    if !@content_nodes['title'].nil?
      @content_nodes['title'].each do
        |titlenode|
        return titlenode if titlenode.title_type.to_s == TITLE_TYPE::MAIN
      end
    end
    get_first_node('title')
  else
    title_clear
    meta = add_title(content, id: id, title_type: title_type)
    yield meta if block_given?
    meta
  end
end