Class: Monolens::Core::Literal

Inherits:
Object
  • Object
show all
Includes:
Lens
Defined in:
lib/monolens/stdlib/core/literal.rb

Instance Attribute Summary

Attributes included from Lens

#options

Instance Method Summary collapse

Methods included from Lens

#fail!, included

Methods included from Lens::FetchSupport

#fetch_on

Constructor Details

#initialize(options, registry) ⇒ Literal

Returns a new instance of Literal.



11
12
13
14
15
16
# File 'lib/monolens/stdlib/core/literal.rb', line 11

def initialize(options, registry)
  super(options, registry)
  @root_symbol = extract_jsonpath_root_symbol
  @one_rx = Jsonpath.one_detect_rx(@root_symbol)
  @interpolate_rx = Jsonpath.interpolate_detect_rx(@root_symbol)
end

Instance Method Details

#call(arg, world = {}) ⇒ Object



18
19
20
# File 'lib/monolens/stdlib/core/literal.rb', line 18

def call(arg, world = {})
  instantiate(option(:defn), arg, world)
end