Module: Jerakia::Response::Filter::Strsub

Defined in:
lib/jerakia/response/filter/strsub.rb

Instance Method Summary collapse

Instance Method Details

#do_substr(data) ⇒ Object


20
21
22
23
24
25
26
27
# File 'lib/jerakia/response/filter/strsub.rb', line 20

def do_substr(data)
  data.gsub!(/%\{([^\}]*)\}/) do |tag|
    Jerakia.log.debug("matched substr #{tag}")
    scopekey = tag.match(/\{([^\}]+)\}/)[1]
    scopekey.gsub!(/^::/, '')
    lookup.scope[scopekey.to_sym]
  end
end

#filter_strsub(_opts = {}) ⇒ Object


13
14
15
16
17
18
# File 'lib/jerakia/response/filter/strsub.rb', line 13

def filter_strsub(_opts = {})
  parse_values do |val|
    do_substr(val) if val.is_a?(String)
    val
  end
end