Sha256: f06d2e7a8f58e9c6c4e1bd40394284b8b124d3578db47bd66929b0d7957a5f65
Contents?: true
Size: 871 Bytes
Versions: 2
Compression:
Stored size: 871 Bytes
Contents
class CloudWatchLogsInsightsUrlBuilder class Criteria def initialize @conditions = [] end def add(key, value) case value when Array result = +encode("~#{key}~(") value.each do |v| result << "#{encode("~'")}#{encode_value(v)}" end @conditions << result + encode(')') when String @conditions << "#{encode("~#{key}~'")}#{encode_value(value)}" else @conditions << "#{encode("~#{key}~")}#{encode_value(value)}" end end def build "#{encode('~(')}#{@conditions.join.delete_prefix(encode('~'))}#{encode(')')}" end private def encode(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