Class: ConsulApplicationSettings::Resolvers::Erb

Inherits:
Object
  • Object
show all
Defined in:
lib/consul_application_settings/resolvers/erb.rb

Overview

Run values through ERB

Constant Summary collapse

IDENTIFIER =
/(<%).*(%>)/.freeze

Instance Method Summary collapse

Instance Method Details

#resolvable?(value, _path) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
10
11
# File 'lib/consul_application_settings/resolvers/erb.rb', line 7

def resolvable?(value, _path)
  return unless value.is_a?(String)

  IDENTIFIER.match?(value)
end

#resolve(value, _path) ⇒ Object



13
14
15
# File 'lib/consul_application_settings/resolvers/erb.rb', line 13

def resolve(value, _path)
  ERB.new(value.to_s).result
end