Class: Spassky::Server::DeviceDatabase
- Inherits:
-
Object
- Object
- Spassky::Server::DeviceDatabase
- Defined in:
- lib/spassky/server/device_database.rb
Direct Known Subclasses
Instance Method Summary collapse
- #device_identifier(user_agent) ⇒ Object
- #download_wurfl_file ⇒ Object
-
#initialize ⇒ DeviceDatabase
constructor
A new instance of DeviceDatabase.
Constructor Details
#initialize ⇒ DeviceDatabase
Returns a new instance of DeviceDatabase.
15 16 17 18 19 |
# File 'lib/spassky/server/device_database.rb', line 15 def initialize download_wurfl_file unless File.exist?(WURFL_FILE) @wurfl = WURFL.new(WURFL_FILE) @stored_device_identifiers = {} end |
Instance Method Details
#device_identifier(user_agent) ⇒ Object
29 30 31 |
# File 'lib/spassky/server/device_database.rb', line 29 def device_identifier user_agent cached_device_identifier(user_agent) or uncached_device_identifier(user_agent) end |
#download_wurfl_file ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/spassky/server/device_database.rb', line 21 def download_wurfl_file FileUtils.mkdir_p(WURFL_DIRECTORY) Kernel.puts("Downloading WURFL database") RestClient.proxy = ENV["http_proxy"] if ENV["http_proxy"] content = RestClient.get(LATEST) save_wurfl_file content end |