Class: ComicBook::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/comic_book/entry.rb

Overview

A single member of a comic book: an image, an info file (ComicInfo.xml / MetronInfo.xml), or anything else.

‘path` locates it within the comic:

a relative path in a folder,
or an entry name in an archive

‘name` is its basename.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Entry

Returns a new instance of Entry.



12
13
14
15
# File 'lib/comic_book/entry.rb', line 12

def initialize path
  @path = path
  @name = File.basename path
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/comic_book/entry.rb', line 10

def name
  @name
end

#pathObject (readonly)

Returns the value of attribute path.



10
11
12
# File 'lib/comic_book/entry.rb', line 10

def path
  @path
end

Instance Method Details

#image?Boolean

Returns:

  • (Boolean)


17
# File 'lib/comic_book/entry.rb', line 17

def image? = ComicBook::IMAGE_EXTENSIONS.include?(File.extname(name).downcase)

#info?Boolean

Returns:

  • (Boolean)


18
# File 'lib/comic_book/entry.rb', line 18

def info?  = ComicBook::INFO_FILENAMES.include?(name)