Class: Epuber::Compiler::FileTypes::SourceFile
- Inherits:
-
AbstractFile
- Object
- AbstractFile
- Epuber::Compiler::FileTypes::SourceFile
- Defined in:
- lib/epuber/compiler/file_types/source_file.rb
Direct Known Subclasses
ImageFile, StaticFile, StylusFile, XHTMLFile, Plugin::PluginFile
Instance Attribute Summary collapse
-
#abs_source_path ⇒ String
Absolute source path.
- #file_request ⇒ Epuber::Book::FileRequest
-
#source_path ⇒ String
readonly
Relative source path.
Attributes inherited from AbstractFile
#destination_path, #final_destination_path, #group, #path_type, #pkg_destination_path, #properties
Instance Method Summary collapse
- #default_file_copy ⇒ Object
-
#initialize(source_path) ⇒ SourceFile
constructor
A new instance of SourceFile.
- #write_compiled(content) ⇒ Object
- #write_processed(content) ⇒ Object
Methods inherited from AbstractFile
#==, file_copy, file_copy!, file_copy?, write_to_file, write_to_file!, write_to_file?
Constructor Details
#initialize(source_path) ⇒ SourceFile
Returns a new instance of SourceFile.
25 26 27 |
# File 'lib/epuber/compiler/file_types/source_file.rb', line 25 def initialize(source_path) @source_path = source_path end |
Instance Attribute Details
#abs_source_path ⇒ String
Returns absolute source path.
17 18 19 |
# File 'lib/epuber/compiler/file_types/source_file.rb', line 17 def abs_source_path @abs_source_path end |
#file_request ⇒ Epuber::Book::FileRequest
21 22 23 |
# File 'lib/epuber/compiler/file_types/source_file.rb', line 21 def file_request @file_request end |
#source_path ⇒ String (readonly)
Returns relative source path.
13 14 15 |
# File 'lib/epuber/compiler/file_types/source_file.rb', line 13 def source_path @source_path end |
Instance Method Details
#default_file_copy ⇒ Object
29 30 31 32 33 34 |
# File 'lib/epuber/compiler/file_types/source_file.rb', line 29 def default_file_copy if self.class.file_copy?(abs_source_path, final_destination_path) UI.print_processing_debug_info("Copying to #{pkg_destination_path}") self.class.file_copy!(abs_source_path, final_destination_path) end end |
#write_compiled(content) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/epuber/compiler/file_types/source_file.rb', line 36 def write_compiled(content) if self.class.write_to_file?(content, final_destination_path) UI.print_processing_debug_info("Writing compiled version to #{pkg_destination_path}") self.class.write_to_file!(content, final_destination_path) end end |
#write_processed(content) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/epuber/compiler/file_types/source_file.rb', line 43 def write_processed(content) if self.class.write_to_file?(content, final_destination_path) UI.print_processing_debug_info("Writing processed version to #{pkg_destination_path}") self.class.write_to_file!(content, final_destination_path) end end |