Sha256: 2024b20ac8416a98d5fd885e1cfd829af9f1336192097eb24244350be3413820

Contents?: true

Size: 598 Bytes

Versions: 11

Compression:

Stored size: 598 Bytes

Contents

module Tagger
  class Event
    attr_accessor :name, :params

    def initialize(name, params = nil)
      @name = name
      @params = params
    end

    def params_for(platform)
      case platform
      when :ios
        map_content = params.map do |key, val|
          '"' + key.to_s + '"' + ": " + '"' + val.to_s + '"'
        end.join(", ")
        "[" + map_content + "]"
      when :android
        map_content = params.map do |key, val|
          '"' + key.to_s + '"' + " to " + '"' + val.to_s + '"'
        end.join(", ")
        "mapOf(" + map_content + ")"
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ai_tagger-0.1.10 lib/tagger/event.rb
ai_tagger-0.1.9 lib/tagger/event.rb
ai_tagger-0.1.8 lib/tagger/event.rb
ai_tagger-0.1.7 lib/tagger/event.rb
ai_tagger-0.1.6 lib/tagger/event.rb
ai_tagger-0.1.5 lib/tagger/event.rb
ai_tagger-0.1.4 lib/tagger/event.rb
ai_tagger-0.1.3 lib/tagger/event.rb
ai_tagger-0.1.2 lib/tagger/event.rb
ai_tagger-0.1.1 lib/tagger/event.rb
ai_tagger-0.1.0 lib/tagger/event.rb