Sha256: 3232b1a0d5325c33eb7d9193018b203598190fba79c2647f2b8230415b0c2a31
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module ActiveForce class SelectBuilder attr_reader :selected_fields, :nested_query_fields, :non_nested_query_fields, :query def initialize(selected_fields, query) @query = query @selected_fields = selected_fields @non_nested_query_fields = [] @nested_query_fields = [] end def parse selected_fields.each do |field| case field when Symbol non_nested_query_fields << query.mappings[field] when Hash populate_nested_query_fields(field) when String non_nested_query_fields << field end end {non_nested_query_fields: non_nested_query_fields, nested_query_fields: nested_query_fields} end private def populate_nested_query_fields(field) field.each do |key, value| case value when Symbol field[key] = [value] when Hash raise ArgumentError, 'Nested Hash is not supported in select statement, you may wish to use an Array' end end nested_query_fields << field end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
active_force-0.24.0 | lib/active_force/select_builder.rb |