Sha256: 6bceb0998ca3ae0fc4c1af269013685b98f80c02c87dce98608813cae0927e01
Contents?: true
Size: 907 Bytes
Versions: 2
Compression:
Stored size: 907 Bytes
Contents
class CloudWatchLogsInsightsUrlBuilder class Criteria def initialize @conditions = [] end def add(key, value) case value when Array result = +encode_key("~#{key}~(") value.each do |v| result << "#{encode_key("~'")}#{encode_value(v)}" end @conditions << result + encode_key(')') when String @conditions << "#{encode_key("~#{key}~'")}#{encode_value(value)}" else @conditions << "#{encode_key("~#{key}~")}#{encode_value(value)}" end end def build "#{encode_key('~(')}#{@conditions.join.delete_prefix(encode_key('~'))}#{encode_key(')')}" end private def encode_key(key) URI.encode_www_form_component(URI.encode_www_form_component(key)).gsub('%', '$') end def encode_value(value) URI.encode_www_form_component(value).gsub('%', '*') end end end
Version data entries
2 entries across 2 versions & 1 rubygems