Sha256: 697638230651b155138dbfdf3e2c03fd62b88a99f63ab91388ee7c7322062088
Contents?: true
Size: 812 Bytes
Versions: 15
Compression:
Stored size: 812 Bytes
Contents
# frozen_string_literal: true module Aserto module ResourceMapper class << self def execute(request) if defined? ::Rails params = request.params return {} unless params.is_a?(Hash) && !params.empty? require_relative "rails/utils" route = Aserto::Rails::Utils.route(request) path = route[:path] if route return {} unless path fields = path.split("/") .select { |part| part.starts_with?(":") } .map { |field| field.sub(":", "") } return {} if fields.empty? require "google/protobuf/well_known_types" return Google::Protobuf::Struct.from_hash(fields.to_h { |field| [field, params[field]] }) end {} end end end end
Version data entries
15 entries across 15 versions & 1 rubygems