Sha256: e3ec6482c6368797eeef4293cecfa51a601900b20403b04f78037d437816831f

Contents?: true

Size: 734 Bytes

Versions: 20

Compression:

Stored size: 734 Bytes

Contents

class Symbol
  # OPERATORS

  def self.operator(operators)
    operators.each do |method, operator|
      class_eval <<-CODE
        def #{method}
          Operator.new(self, '#{operator}')
        end
      CODE
    end
  end

  # Sorting
  def desc
    Operator.new(self, '-', true)
  end

  operator  :eql => '==',
            :not_eql => '!=',
            :gt => '>',
            :gte => '>=',
            :lt => '<',
            :lte => '<=',
            :matches => '==',
            :does_not_match => '!=',
            :contains => '=~',
            :does_not_contain => '!~',
            :substring => '=@',
            :not_substring => '!@'

  # Metric filters  
  def to_ga
    "ga:#{self.to_s.lower_camelized}"
  end
end

Version data entries

20 entries across 20 versions & 4 rubygems

Version Path
jonuts-garb-0.2.3 lib/extensions/symbol.rb
macros-garb-0.2.6 lib/extensions/symbol.rb
vigetlabs-garb-0.1.2 lib/extensions/symbol.rb
vigetlabs-garb-0.2.0 lib/extensions/symbol.rb
vigetlabs-garb-0.2.1 lib/extensions/symbol.rb
vigetlabs-garb-0.2.2 lib/extensions/symbol.rb
vigetlabs-garb-0.2.3 lib/extensions/symbol.rb
vigetlabs-garb-0.2.4 lib/extensions/symbol.rb
vigetlabs-garb-0.2.5 lib/extensions/symbol.rb
vigetlabs-garb-0.2.6 lib/extensions/symbol.rb
garb-0.4.0 lib/extensions/symbol.rb
garb-0.3.2 lib/extensions/symbol.rb
garb-0.3.1 lib/extensions/symbol.rb
garb-0.3.0 lib/extensions/symbol.rb
garb-0.2.9 lib/extensions/symbol.rb
garb-0.2.8 lib/extensions/symbol.rb
garb-0.2.4 lib/extensions/symbol.rb
garb-0.2.6 lib/extensions/symbol.rb
garb-0.2.3 lib/extensions/symbol.rb
garb-0.2.1 lib/extensions/symbol.rb