module Jerakia::Response::Filter::Strsub

Public Instance Methods

do_substr(data) click to toggle source
# 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 = {}) click to toggle source
# 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