module Trailblazer::Endpoint::Options

Public Class Methods

merge_with(merged, hash) click to toggle source

Merge {merged} into {hash}, but only keys that exist in {hash}.

# File lib/trailblazer/endpoint/options.rb, line 45
def self.merge_with(merged, hash)
  keys = hash.keys
  merged = keys.collect { |key| merged.key?(key) ? [key, merged[key]] : nil }.compact.to_h
  hash.merge(merged)
end

Public Instance Methods

options_for(directive_name, runtime_options) click to toggle source
# File lib/trailblazer/endpoint/options.rb, line 31
def options_for(directive_name, runtime_options)
  normalizer = @normalizers.fetch(directive_name)

  ctx = Trailblazer::Context(runtime_options, {})

  # signal, (ctx, ) = Trailblazer::Developer.wtf?(normalizer, [ctx])
  signal, (ctx, ) = Trailblazer::Activity::TaskWrap.invoke(normalizer, [ctx])

  _, options = ctx.decompose
  options
end