Class: Export
- Inherits:
-
IRB::Command::Base
- Object
- IRB::Command::Base
- Export
- Defined in:
- lib/alet/irb/command/export.rb
Instance Method Summary collapse
Instance Method Details
#execute(arg) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/alet/irb/command/export.rb', line 6 def execute(arg) soql = if /\ASELECT/.match?(arg.strip.upcase) arg else object = eval(arg) object.to_soql if object&.instance_of? SObjectModel::QueryMethods::QueryCondition end return if soql.nil? csv = sf.data.query(soql, format: :csv, target_org: ::Alet.config.org.alias) filename = "#{Time.now.strftime('%Y%m%d%H%M%S')}_export.csv" File.open(filename, 'w'){|f| f.write(csv) } puts filename end |