Class: Sheetsy::Converter
- Inherits:
-
Object
- Object
- Sheetsy::Converter
- Defined in:
- lib/sheetsy/converter.rb
Instance Attribute Summary collapse
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #debug? ⇒ Boolean
-
#initialize(source, destination, options = {}) ⇒ Converter
constructor
A new instance of Converter.
- #overwrite? ⇒ Boolean
- #run ⇒ Object
Constructor Details
#initialize(source, destination, options = {}) ⇒ Converter
Returns a new instance of Converter.
7 8 9 10 11 |
# File 'lib/sheetsy/converter.rb', line 7 def initialize(source, destination, = {}) @source = source @destination = destination @options = end |
Instance Attribute Details
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
5 6 7 |
# File 'lib/sheetsy/converter.rb', line 5 def destination @destination end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/sheetsy/converter.rb', line 5 def @options end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
5 6 7 |
# File 'lib/sheetsy/converter.rb', line 5 def source @source end |
Instance Method Details
#debug? ⇒ Boolean
32 33 34 |
# File 'lib/sheetsy/converter.rb', line 32 def debug? @debug ||= [:debug] end |
#overwrite? ⇒ Boolean
28 29 30 |
# File 'lib/sheetsy/converter.rb', line 28 def overwrite? @overwrite ||= [:overwrite] end |
#run ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sheetsy/converter.rb', line 13 def run debug "Files found: #{files.count}" .progress = 0 FileUtils.mkdir_p(destination) unless File.directory?(destination) files.each do |file| process_file(file) .increment end puts "Conversion complete." end |