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

Inherits:
Object
  • Object
show all
Includes:
Inspector::PublicationModel
Defined in:
lib/epub/publication/package/bindings.rb

Defined Under Namespace

Classes: MediaType

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Inspector::PublicationModel

included, #inspect, #template

Constructor Details

#initializeBindings

Returns a new instance of Bindings



8
9
10
# File 'lib/epub/publication/package/bindings.rb', line 8

def initialize
  @media_types = {}
end

Instance Attribute Details

#packageObject

Returns the value of attribute package



6
7
8
# File 'lib/epub/publication/package/bindings.rb', line 6

def package
  @package
end

Instance Method Details

#<<(media_type) ⇒ Object



12
13
14
# File 'lib/epub/publication/package/bindings.rb', line 12

def <<(media_type)
  @media_types[media_type.media_type] = media_type
end

#[](media_type) ⇒ Object



16
17
18
19
# File 'lib/epub/publication/package/bindings.rb', line 16

def [](media_type)
  _, mt = @media_types.detect {|key, _| key == media_type}
  mt
end

#media_typesObject



21
22
23
# File 'lib/epub/publication/package/bindings.rb', line 21

def media_types
  @media_types.values
end