device_map 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/device_map.rb CHANGED
@@ -1,5 +1,35 @@
1
- require "device_map/version"
1
+ require 'nokogiri'
2
2
 
3
3
  module DeviceMap
4
- # Your code goes here...
4
+ autoload :Classifier, 'device_map/classifier'
5
+ autoload :Keyword, 'device_map/keyword'
6
+ autoload :Pattern, 'device_map/pattern'
7
+ autoload :UserAgent, 'device_map/user_agent'
8
+ autoload :VERSION, 'device_map/version'
9
+
10
+ module DeviceData
11
+ autoload :Builder, 'device_map/device_data/builder'
12
+ autoload :Device, 'device_map/device_data/device'
13
+ autoload :Devices, 'device_map/device_data/devices'
14
+ autoload :Patterns, 'device_map/device_data/patterns'
15
+ end
16
+
17
+ module Properties
18
+ autoload :DSL, 'device_map/properties/dsl'
19
+ autoload :Property, 'device_map/properties/property'
20
+ autoload :Types, 'device_map/properties/types'
21
+ end
22
+
23
+ RESOURCES_PATH = File.expand_path('resources', __dir__)
24
+
25
+ BUILDER_DATA_SOURCE = File.join(RESOURCES_PATH, 'BuilderDataSource.xml')
26
+ DEVICE_DATA_SOURCE = File.join(RESOURCES_PATH, 'DeviceDataSource.xml')
27
+
28
+ PATTERNS_DUMP = File.join(RESOURCES_PATH, 'patterns')
29
+ DEVICES_DUMP = File.join(RESOURCES_PATH, 'devices')
30
+
31
+ def self.classify(user_agent)
32
+ classifier = Classifier.instance
33
+ classifier.find_device(user_agent)
34
+ end
5
35
  end