Class: EpubForge::Builder::Assets::Image

Inherits:
Asset
  • Object
show all
Defined in:
lib/epubforge/builder/assets/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Asset

#media_type

Constructor Details

#initialize(filename, options = {}) ⇒ Image

Returns a new instance of Image.



6
7
8
9
# File 'lib/epubforge/builder/assets/image.rb', line 6

def initialize( filename, options = {} )
  @filename = filename.fwf_filepath
  @name, @ext  = @filename.basename_and_ext
end

Instance Attribute Details

#extObject (readonly)

Returns the value of attribute ext.



5
6
7
# File 'lib/epubforge/builder/assets/image.rb', line 5

def ext
  @ext
end

#filenameObject (readonly)

Returns the value of attribute filename.



5
6
7
# File 'lib/epubforge/builder/assets/image.rb', line 5

def filename
  @filename
end

#nameObject (readonly)

Returns the value of attribute name.



5
6
7
# File 'lib/epubforge/builder/assets/image.rb', line 5

def name
  @name
end

Instance Method Details

#cover?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/epubforge/builder/assets/image.rb', line 19

def cover?
  self.name == "cover"
end

#item_idObject



15
16
17
# File 'lib/epubforge/builder/assets/image.rb', line 15

def item_id
  cover? ? "cover-image" : self.link.basename
end


11
12
13
# File 'lib/epubforge/builder/assets/image.rb', line 11

def link
  IMAGE_DIR.join( "#{@name}.#{@ext}"  )
end