Class: Mobvious::Config
- Inherits:
-
Object
- Object
- Mobvious::Config
- Defined in:
- lib/mobvious/config.rb
Overview
Class encapsulating Mobvious configuration.
Set configuration options them via calling Mobvious.config.
Instance Attribute Summary collapse
-
#default_device_type ⇒ Object
Default device type is used when no strategy was successful (all return nil or none is present).
-
#strategies ⇒ Object
Strategies used to determine device type from a request.
Instance Method Summary collapse
-
#clear ⇒ Object
Resets a configuration to no strategies and default device type
:desktop
. -
#initialize ⇒ Config
constructor
Creates a new configuration with no strategies and default device type
:desktop
.
Constructor Details
#initialize ⇒ Config
Creates a new configuration with no strategies and default device type :desktop
.
7 8 9 |
# File 'lib/mobvious/config.rb', line 7 def initialize() self.clear end |
Instance Attribute Details
#default_device_type ⇒ Object
Default device type is used when no strategy was successful (all return nil or none is present).
24 25 26 |
# File 'lib/mobvious/config.rb', line 24 def default_device_type @default_device_type end |
#strategies ⇒ Object
Strategies used to determine device type from a request. They are evaluated in the order they are inserted. Result of the first successful strategy (returning something else than nil) is used.
20 21 22 |
# File 'lib/mobvious/config.rb', line 20 def strategies @strategies end |
Instance Method Details
#clear ⇒ Object
Resets a configuration to no strategies and default device type :desktop
.
12 13 14 15 |
# File 'lib/mobvious/config.rb', line 12 def clear @strategies = [] @default_device_type = :desktop end |