Sha256: 535b0c7e35828c08cbaaf5bcb828f4e27fb686554e927e155c092cc5e1398d61
Contents?: true
Size: 638 Bytes
Versions: 5
Compression:
Stored size: 638 Bytes
Contents
module Monolens class Macros def initialize(macros, registry) @macros = macros @registry = registry end def factor_lens(namespace_name, lens_name, options, registry) if defn = @macros[lens_name] instantiate_macro(defn, options) else raise Error, "No such lens #{[namespace_name, lens_name].join('.')}" end end private def instantiate_macro(defn, options) instantiated = Monolens::Core.literal({ defn: defn, jsonpath: { root_symbol: '<' } }, @registry).call(options) @registry.lens(instantiated) end end end
Version data entries
5 entries across 5 versions & 1 rubygems