Class: Query

Inherits:
IRB::Command::Base
  • Object
show all
Defined in:
lib/alet/irb/command/query.rb

Instance Method Summary collapse

Instance Method Details

#execute(arg) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/alet/irb/command/query.rb', line 8

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?

  puts sf.data.query(soql, format: :human, target_org: ::Alet.config.connection.alias)
end