Class: Stringento::Resolver

Inherits:
Object
  • Object
show all
Defined in:
lib/stringento/resolver.rb

Overview

This is the base class / implementation for how values are resolved. In order to change this:

  • Derive a subclass

  • Override the #resolve method

  • Pass instance into into Stringento#evaluate

Instance Method Summary collapse

Instance Method Details

#resolve(value, input) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/stringento/resolver.rb', line 17

def resolve(value, input)
  if input&.respond_to?(:[])
    input[value]
  elsif input&.respond_to?(value)
    input.send(value)
  end
end