class GoogleAnalyticsFeeds::FilterBuilder
Construct filters for a DataFeed
.
@api private
Public Class Methods
new()
click to toggle source
# File lib/google_analytics_feeds.rb, line 181 def initialize @filters = [] end
Public Instance Methods
build(&block)
click to toggle source
# File lib/google_analytics_feeds.rb, line 185 def build(&block) instance_eval(&block) @filters.join(';') end
contains(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 200 def contains(n, v) filter(n, v, '=@') end
eql(name, value)
click to toggle source
TODO: remove duplication
# File lib/google_analytics_feeds.rb, line 192 def eql(name, value) filter(name, value, '==') end
gt(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 208 def gt(n, v) filter(n, v, '>') end
gte(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 212 def gte(n, v) filter(n, v, '>=') end
lt(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 216 def lt(n, v) filter(n, v, '<') end
lte(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 220 def lte(n, v) filter(n, v, '<=') end
match(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 224 def match(n, v) filter(n, v, '=~') end
not_contains(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 204 def not_contains(n, v) filter(n, v, '!@') end
not_eql(name, value)
click to toggle source
# File lib/google_analytics_feeds.rb, line 196 def not_eql(name, value) filter(name, value, '!=') end
not_match(n, v)
click to toggle source
# File lib/google_analytics_feeds.rb, line 228 def not_match(n, v) filter(n, v, '!~') end
Private Instance Methods
filter(name, value, operation)
click to toggle source
# File lib/google_analytics_feeds.rb, line 234 def filter(name, value, operation) @filters << [symbol_to_name(name), operation, value.to_s].join('') end