Class: PushBot::Platform

Inherits:
Object
  • Object
show all
Defined in:
lib/push_bot/platform.rb

Constant Summary collapse

VALUES =
%w(ios android)

Class Method Summary collapse

Class Method Details

.parse(*platforms) ⇒ Object

Translate an array of :ios / :android into an array of integer strings

Parameters:

  • platforms

    any of ‘:ios` and `:android`

Raises:

  • (ArgumentError)


9
10
11
12
13
14
# File 'lib/push_bot/platform.rb', line 9

def self.parse(*platforms)
  platforms = platforms.flatten.map! {|p| VALUES.index(p.to_s.downcase) }
  raise(ArgumentError, 'Platform must be ios or android') if platforms.any?(&:nil?)

  platforms.map!(&:to_s)
end