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.
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
#add_to_filecache, config, #config, crit, fatal, filecache, log, #log
Constructor Details
Instance Attribute Details
#entries ⇒ Object
Returns the value of attribute entries.
3 4 5 |
# File 'lib/jerakia/response.rb', line 3 def entries @entries end |
#lookup ⇒ Object (readonly)
Returns the value of attribute lookup.
4 5 6 |
# File 'lib/jerakia/response.rb', line 4 def lookup @lookup end |
Instance Method Details
#no_more_answers ⇒ Object
52 53 54 |
# File 'lib/jerakia/response.rb', line 52 def no_more_answers Jerakia.log.debug "warning: backend tried to submit too many answers" end |
#parse_values ⇒ Object
40 41 42 43 44 45 46 47 48 |
# File 'lib/jerakia/response.rb', line 40 def parse_values @entries.map! do |entry| Jerakia::Util.walk(entry[:value]) do |v| yield v end entry end end |
#submit(val) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/jerakia/response.rb', line 21 def submit(val) Jerakia.log.debug "Backend submitted #{val}" unless want? no_more_answers else @entries << { :value => val, :datatype => val.class.to_s.downcase } Jerakia.log.debug "Added answer #{val}" end end |
#values ⇒ Object
34 35 36 37 38 |
# File 'lib/jerakia/response.rb', line 34 def values Jerakia::Util.walk(@entries) do |entry| yield entry end end |
#want? ⇒ Boolean
13 14 15 16 17 18 19 |
# File 'lib/jerakia/response.rb', line 13 def want? if lookup.request.lookup_type == :first && entries.length > 0 return false else return true end end |