Class: Geoptima::RunningApps

Inherits:
Object
  • Object
show all
Defined in:
lib/geoptima/data.rb

Overview

This class allows the ‘runningApps’ event to behave differently than normal events. It is used by the GPX exporter to color code these based on the app category

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ RunningApps

Returns a new instance of RunningApps.



640
641
642
# File 'lib/geoptima/data.rb', line 640

def initialize(event)
  @inner_event = event
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(symbol, *args, &block) ⇒ Object



643
644
645
# File 'lib/geoptima/data.rb', line 643

def method_missing(symbol,*args,&block)
  @inner_event.send symbol, *args, &block
end

Instance Attribute Details

#inner_eventObject (readonly)

Returns the value of attribute inner_event.



639
640
641
# File 'lib/geoptima/data.rb', line 639

def inner_event
  @inner_event
end

Instance Method Details

#descriptionObject



646
647
648
# File 'lib/geoptima/data.rb', line 646

def description
  @inner_event['appName']
end

#gpx_idObject



652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
# File 'lib/geoptima/data.rb', line 652

def gpx_id
  app = @inner_event['appName']
  if $app_categories && $app_categories.length > 0
    puts "Choosing internal GPX ID based on specified categories: #{$app_categories.describe}" if($debug)
    if $app_categories.categories.length == 1
      puts "Filtering on only one category, using app name for GPX ID: #{app}" if($debug)
      if (a=$app_categories[app]) && a.category =~ /\w/
        a.key
      else
        nil
      end
    elsif (a=$app_categories[app]) && a.category =~ /\w/
      puts "Found matching category app[#{app}] => #{a.category}" if($debug)
      a.category
    else
      nil
    end
  else
    app
  end
end

#valid_gpx?Boolean

Returns:

  • (Boolean)


649
650
651
# File 'lib/geoptima/data.rb', line 649

def valid_gpx?
  @inner_event.valid_gpx? && @inner_event['state'] == 'STARTED'
end