Sha256: 72ce1f04e717f9383574a0de44f604ab7e733ec513ba96f8756471dde325b247
Contents?: true
Size: 1.09 KB
Versions: 14
Compression:
Stored size: 1.09 KB
Contents
<%- assert_locals resource -%> ## # Create a fully-qualified <%= resource.name %> resource string. # <%- resource.patterns.each do |pattern| -%> <%- args_doc_sig = pattern.arguments.map { |arg| "#{arg}:" }.join ", " -%> # @overload <%= resource.path_helper %>(<%= args_doc_sig %>) <%= indent render(partial: "service/client/resource/doc", locals: { pattern: pattern }), "# " %> # <%- end -%> # @return [String] def <%= resource.path_helper %> **args resources = { <%- last_pattern_index = resource.patterns.count - 1 -%> <%- resource.patterns.each_with_index do |pattern, index| -%> <%- comma = last_pattern_index == index ? "" : "," -%> <%- args_key = pattern.arguments.sort.join(":").inspect -%> <%- args_sig = pattern.arguments.map { |arg| "#{arg}:" }.join ", " -%> <%= args_key %> => (proc do |<%= args_sig %>| <%= indent render(partial: "service/client/resource/def", locals: { pattern: pattern }), 6 %> end)<%= comma %> <%- end -%> } resource = resources[args.keys.sort.join(":")] raise ArgumentError, "no resource found for values #{args.keys}" if resource.nil? resource.call(**args) end
Version data entries
14 entries across 14 versions & 1 rubygems