Method: EPlat::Client#platform_klass

Defined in:
lib/e_plat/client.rb

#platform_klass(klass) ⇒ Object

Dynamically determines the class based on the platform needs to return nil if there isn’t a more specific class than the klass passed in



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/e_plat/client.rb', line 25

def platform_klass(klass)
	return if klass.to_s.include? "EPlat::#{platform.capitalize}"
	
	platform_specific_class_name = klass.to_s.gsub("EPlat::", "EPlat::#{platform.capitalize}::")

	platform_specific_class = platform_specific_class_name.safe_constantize
	if platform_specific_class_name != klass.to_s && platform_specific_class
		platform_specific_class
	else
		nil
	end
end