Class: D3MPQ::Command::CSV
- Inherits:
-
Object
- Object
- D3MPQ::Command::CSV
- Defined in:
- lib/d3_mpq/commands/csv.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #csv_name ⇒ Object
- #csv_path ⇒ Object
- #generator_params ⇒ Object
-
#initialize(options = {}) ⇒ CSV
constructor
A new instance of CSV.
- #input_path ⇒ Object
- #locale ⇒ Object
- #output_path ⇒ Object
- #patch ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CSV
Returns a new instance of CSV.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/d3_mpq/commands/csv.rb', line 7 def initialize( = {}) @options = @klass = @options[:klass] FileUtils.mkdir_p csv_path klass = eval("D3MPQ::CSVGenerator::#{@klass}") generator = klass.new(generator_params) generator.write end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/d3_mpq/commands/csv.rb', line 5 def @options end |
Instance Method Details
#csv_name ⇒ Object
26 27 28 |
# File 'lib/d3_mpq/commands/csv.rb', line 26 def csv_name @options[:csv_name] || @klass.to_s end |
#csv_path ⇒ Object
42 43 44 |
# File 'lib/d3_mpq/commands/csv.rb', line 42 def csv_path [:csv_path] end |
#generator_params ⇒ Object
18 19 20 |
# File 'lib/d3_mpq/commands/csv.rb', line 18 def generator_params { :files => input_path, :output_path => output_path } end |
#input_path ⇒ Object
38 39 40 |
# File 'lib/d3_mpq/commands/csv.rb', line 38 def input_path [:csv_input] end |
#locale ⇒ Object
30 31 32 |
# File 'lib/d3_mpq/commands/csv.rb', line 30 def locale ".#{[:locale]}" if [:locale] && ![:locale].empty? end |
#output_path ⇒ Object
22 23 24 |
# File 'lib/d3_mpq/commands/csv.rb', line 22 def output_path "#{csv_path}/#{csv_name}#{patch}#{locale}.csv" end |
#patch ⇒ Object
34 35 36 |
# File 'lib/d3_mpq/commands/csv.rb', line 34 def patch ".#{[:patch]}" if [:patch] && ![:patch].empty? end |