Class: EPUB::Publication::Package::Bindings

Inherits:
Object
  • Object
show all
Includes:
ContentModel
Defined in:
lib/epub/maker/publication.rb

Instance Method Summary collapse

Methods included from ContentModel

#to_xml_attribute

Instance Method Details

#make {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



359
360
361
362
# File 'lib/epub/maker/publication.rb', line 359

def make
  yield self if block_given?
  self
end

#make_media_type {|media_type| ... } ⇒ Object

Yields:

  • (media_type)


364
365
366
367
368
369
# File 'lib/epub/maker/publication.rb', line 364

def make_media_type
  media_type = MediaType.new
  self << media_type
  yield media_type if block_given?
  media_type
end

#to_xml_fragment(xml) ⇒ Object



371
372
373
374
375
376
377
378
379
# File 'lib/epub/maker/publication.rb', line 371

def to_xml_fragment(xml)
  xml.bindings_ {
    media_types.each do |media_type|
      media_type_node = xml.mediaType
      to_xml_attribute media_type_node, media_type, [:media_type]
      media_type_node['handler'] = media_type.handler.id if media_type.handler && media_type.handler.id
    end
  }
end