Class: Source2Epub::Exporter
- Inherits:
-
Object
- Object
- Source2Epub::Exporter
- Defined in:
- lib/source2epub/exporter.rb
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
readonly
Returns the value of attribute base_dir.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#epub_title ⇒ Object
readonly
Returns the value of attribute epub_title.
-
#exts ⇒ Object
readonly
Returns the value of attribute exts.
-
#non_exts ⇒ Object
readonly
Returns the value of attribute non_exts.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#export ⇒ Object
Print and export the source from a given URL to an epub file.
-
#initialize(url, opts = {}) ⇒ Exporter
constructor
Constructor for Executor.
Constructor Details
#initialize(url, opts = {}) ⇒ Exporter
Constructor for Executor
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/source2epub/exporter.rb', line 26 def initialize(url, opts = {}) @url = url @base_dir = Dir.pwd @exts = opts[:exts] || [] @non_exts = opts[:non_exts] || [] @theme = opts[:theme] || "default" @command = opts[:command] @repo_name = project_name(url) @epub_title = opts[:epub_title] || @repo_name @output_path = File.([base_dir, repo_name].join(File::SEPARATOR)) end |
Instance Attribute Details
#base_dir ⇒ Object (readonly)
Returns the value of attribute base_dir.
11 12 13 |
# File 'lib/source2epub/exporter.rb', line 11 def base_dir @base_dir end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
4 5 6 |
# File 'lib/source2epub/exporter.rb', line 4 def command @command end |
#epub_title ⇒ Object (readonly)
Returns the value of attribute epub_title.
4 5 6 |
# File 'lib/source2epub/exporter.rb', line 4 def epub_title @epub_title end |
#exts ⇒ Object (readonly)
Returns the value of attribute exts.
4 5 6 |
# File 'lib/source2epub/exporter.rb', line 4 def exts @exts end |
#non_exts ⇒ Object (readonly)
Returns the value of attribute non_exts.
4 5 6 |
# File 'lib/source2epub/exporter.rb', line 4 def non_exts @non_exts end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
11 12 13 |
# File 'lib/source2epub/exporter.rb', line 11 def output_path @output_path end |
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
11 12 13 |
# File 'lib/source2epub/exporter.rb', line 11 def repo_name @repo_name end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
4 5 6 |
# File 'lib/source2epub/exporter.rb', line 4 def theme @theme end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/source2epub/exporter.rb', line 4 def url @url end |
Instance Method Details
#export ⇒ Object
Print and export the source from a given URL to an epub file
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/source2epub/exporter.rb', line 39 def export clone puts "FYI: list of extensions: #{all_extensions}" # Note: if we are using the '--command', it will be empty list by default puts "FYI: list of all files : #{all_files}" unless all_files.empty? files2htmls htmls2epub copy_output cleanup end |