Class: Nocode::Steps::Serialize::Csv
- Inherits:
-
Nocode::Step
- Object
- Nocode::Step
- Nocode::Steps::Serialize::Csv
- Defined in:
- lib/nocode/steps/serialize/csv.rb
Overview
Take the contents of a register and create a CSV out of its contents. The CSV contents will override the register specified.
Constant Summary
Constants included from Util::Optionable
Util::Optionable::OPTION_PREFIX
Instance Attribute Summary
Attributes inherited from Nocode::Step
#context, #name, #options, #type
Instance Method Summary collapse
Methods inherited from Nocode::Step
Methods included from Util::Optionable
included, #method_missing, #options, #respond_to_missing?
Methods included from Util::Arrayable
Constructor Details
This class inherits a constructor from Nocode::Step
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Nocode::Util::Optionable
Instance Method Details
#perform ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/nocode/steps/serialize/csv.rb', line 11 def perform input = registers[register_option] registers[register_option] = CSV.generate do |csv| array(input).each_with_index do |object, index| csv << object.keys if index.zero? && object.respond_to?(:keys) add_object(object, csv) end end end |