Class: Watirmark::Model::UploadCSV

Inherits:
Factory show all
Defined in:
lib/watirmark/models/upload_csv.rb

Instance Attribute Summary

Attributes inherited from Factory

#children, #defaults, #keywords, #model_name, #model_type, #models, #parent, #updates

Attributes included from FactoryMethods

#default, #included_traits, #keys, #model_type_name, #search

Instance Method Summary collapse

Methods inherited from Factory

#add_model, #clear_updates, #find, #hash_id, #includes?, #initialize, #inspect, #marshal_dump, #marshal_load, #model_class_name, #remove_empty_entries, #search_term, #strip_equals_from_method_name, #to_h, #unique_instance_name, #update, #update_existing_members, #uuid

Methods included from FactoryMethods

#children, #defaults, #inherited, #keywords, #model, #model_type, #search_term, #traits

Methods included from FactoryMethodGenerators

#method_missing

Methods included from DebugMethods

#add_debug_overrides, #model_name=

Methods included from CucumberHelper

#format_value, #insert_model, #merge_cucumber_table

Constructor Details

This class inherits a constructor from Watirmark::Model::Factory

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Watirmark::Model::FactoryMethodGenerators

Instance Method Details

#create_csv(table) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/watirmark/models/upload_csv.rb', line 7

def create_csv(table)
  Watirmark.logger.info "Creating temporary CSV: #{csv_file}"
  Watirmark.logger.info table.inspect
  CSV.open(csv_file, 'wb') do |csv|
    table.each do |line|
      csv << line
    end
  end
end

#csv_fileObject



17
18
19
20
# File 'lib/watirmark/models/upload_csv.rb', line 17

def csv_file
  @file ||= Tempfile.new(%w(csv_data .csv))
  @file.path
end