Class: Jerakia::Response
- Defined in:
- lib/jerakia/response/filter/strsub.rb,
lib/jerakia/response.rb,
lib/jerakia/response/filter.rb,
lib/jerakia/response/filter/encryption.rb
Overview
strsub is in output filter that matches tags in data and replaces them for values in the scope. It mimics the hiera features of being able to embed %var in YAML documents. This output filter may not provide 100% compatibility to hiera but it should cover most scenarios.
Jerakia does not support method or literal interpolations, just straightforward %var and %var
::var will be lookuped up as scope
Defined Under Namespace
Modules: Filter
Constant Summary
Constants inherited from Jerakia
Instance Attribute Summary collapse
-
#entries ⇒ Object
Returns the value of attribute entries.
-
#lookup ⇒ Object
readonly
Returns the value of attribute lookup.
Attributes inherited from Jerakia
Instance Method Summary collapse
-
#initialize(lookup) ⇒ Response
constructor
A new instance of Response.
- #no_more_answers ⇒ Object
- #parse_values ⇒ Object
- #submit(val) ⇒ Object
- #values ⇒ Object
- #want? ⇒ Boolean
Methods inherited from Jerakia
Constructor Details
Instance Attribute Details
#entries ⇒ Object
Returns the value of attribute entries.
2 3 4 |
# File 'lib/jerakia/response.rb', line 2 def entries @entries end |
#lookup ⇒ Object (readonly)
Returns the value of attribute lookup.
3 4 5 |
# File 'lib/jerakia/response.rb', line 3 def lookup @lookup end |
Instance Method Details
#no_more_answers ⇒ Object
48 49 50 |
# File 'lib/jerakia/response.rb', line 48 def no_more_answers Jerakia.log.debug 'warning: backend tried to submit too many answers' end |
#parse_values ⇒ Object
39 40 41 42 43 44 45 46 |
# File 'lib/jerakia/response.rb', line 39 def parse_values @entries.map! do |entry| Jerakia::Util.walk(entry[:value]) do |v| yield v end entry end end |
#submit(val) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jerakia/response.rb', line 20 def submit(val) Jerakia.log.debug "Backend submitted #{val}" if want? @entries << { :value => val, :datatype => val.class.to_s.downcase } Jerakia.log.debug "Added answer #{val}" else no_more_answers end end |
#values ⇒ Object
33 34 35 36 37 |
# File 'lib/jerakia/response.rb', line 33 def values Jerakia::Util.walk(@entries) do |entry| yield entry end end |
#want? ⇒ Boolean
12 13 14 15 16 17 18 |
# File 'lib/jerakia/response.rb', line 12 def want? if lookup.request.lookup_type == :first && !entries.empty? return false else return true end end |