Class: Monolens::Macros

Inherits:
Object
  • Object
show all
Defined in:
lib/monolens/macros.rb

Instance Method Summary collapse

Constructor Details

#initialize(macros, registry) ⇒ Macros

Returns a new instance of Macros.



3
4
5
6
# File 'lib/monolens/macros.rb', line 3

def initialize(macros, registry)
  @macros = macros
  @registry = registry
end

Instance Method Details

#factor_lens(namespace_name, lens_name, options, registry) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/monolens/macros.rb', line 8

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