Class: SymbolOperator
- Inherits:
-
Object
- Object
- SymbolOperator
- Defined in:
- lib/support.rb
Instance Method Summary collapse
-
#initialize(field, operator) ⇒ SymbolOperator
constructor
A new instance of SymbolOperator.
- #to_google_analytics ⇒ Object
Constructor Details
#initialize(field, operator) ⇒ SymbolOperator
Returns a new instance of SymbolOperator.
2 3 4 |
# File 'lib/support.rb', line 2 def initialize(field, operator) @field, @operator = field, operator end |
Instance Method Details
#to_google_analytics ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/support.rb', line 6 def to_google_analytics operators = { :eql => '==', :not_eql => '!=', :gt => '>', :gte => '>=', :lt => '<', :lte => '<=', :matches => '==', :does_not_match => '!=', :contains => '=~', :does_not_contain => '!~', :substring => '=@', :not_substring => '!@', :desc => '-', :descending => '-' } target = Garb.to_google_analytics(@field) operator = operators[@operator] [:desc, :descending].include?(@operator) ? "#{operator}#{target}" : "#{target}#{operator}" end |