Class: SourceFile
Overview
SourceFile defines objects, which represent the original html-files,
to be processed by the slideshow-generator. Each SourceFile-object will
provide a few details about the contents and location of 1 such file.
Constant Summary collapse
- @@log =
self::init_logger
Instance Attribute Summary collapse
-
#dirname ⇒ Object
readonly
Returns the value of attribute dirname.
-
#file_ext ⇒ Object
readonly
Returns the value of attribute file_ext.
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
-
#images ⇒ Object
readonly
Returns the value of attribute images.
-
#img_count ⇒ Object
readonly
Returns the value of attribute img_count.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(path, options) ⇒ SourceFile
constructor
A new instance of SourceFile.
Methods included from Logging
init_logger, log_level=, log_target=
Methods included from File_Checking
file_check, #file_check, last_mime_type, magic_check, mime_check
Constructor Details
#initialize(path, options) ⇒ SourceFile
Returns a new instance of SourceFile.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/sourcefile.rb', line 44 def initialize(path, ) @log = @@log @log.debug(format("initializing SourceFile for %s ", path)) if @log @log.debug('options are ' << .to_s) @path = path @formats = .formats # file extension local = 'files' == .source_type @file_ext = ((local || .merge) ? '.html' : File.extname(@path)) # file name without path or extension @file_name = File.basename(@path.gsub("\\", '/'), @file_ext) # directory where the original html-file is found @dirname = File.dirname(@path) # All references to image-files, found in the file @images = Array.new # number of images, found @img_count = 0 # title of the original page # or the final slide show file @title = nil @title = .title if .title && !.title.empty? @title.strip! if @title # scan sub-directories (local image-files, only) @recursive = .recursive @log.debug("recursive ? " << @recursive.to_s) @log.debug(format("files from %s", (local ? 'directory' : 'html')) ) if @log # read pages or files, analyze, set image-references and title if(local) read_dir elsif(.merge) read_files else read_file end @log.debug("sourcefile initialized: " + @path) if @log end |
Instance Attribute Details
#dirname ⇒ Object (readonly)
Returns the value of attribute dirname.
42 43 44 |
# File 'lib/sourcefile.rb', line 42 def dirname @dirname end |
#file_ext ⇒ Object (readonly)
Returns the value of attribute file_ext.
42 43 44 |
# File 'lib/sourcefile.rb', line 42 def file_ext @file_ext end |
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
42 43 44 |
# File 'lib/sourcefile.rb', line 42 def file_name @file_name end |
#images ⇒ Object (readonly)
Returns the value of attribute images.
42 43 44 |
# File 'lib/sourcefile.rb', line 42 def images @images end |
#img_count ⇒ Object (readonly)
Returns the value of attribute img_count.
42 43 44 |
# File 'lib/sourcefile.rb', line 42 def img_count @img_count end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
42 43 44 |
# File 'lib/sourcefile.rb', line 42 def title @title end |