Class: Blackbriar::ValueProvider
- Inherits:
-
Object
- Object
- Blackbriar::ValueProvider
- Defined in:
- lib/blackbriar/value_provider.rb
Instance Method Summary collapse
-
#initialize(data) ⇒ ValueProvider
constructor
A new instance of ValueProvider.
- #resolve(arg) ⇒ Object
Constructor Details
#initialize(data) ⇒ ValueProvider
Returns a new instance of ValueProvider.
12 13 14 |
# File 'lib/blackbriar/value_provider.rb', line 12 def initialize(data) @data = data.deep_stringify_keys end |
Instance Method Details
#resolve(arg) ⇒ Object
16 17 18 19 20 |
# File 'lib/blackbriar/value_provider.rb', line 16 def resolve(arg) path = is_json_path?(arg.to_s) ? arg.to_s.split(":").last : nil return arg unless path JsonPath.on(data, path).first end |