Class: Mobvious::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/mobvious/config.rb

Overview

Class encapsulating Mobvious configuration.

Set configuration options them via calling Mobvious.config.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

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_typeObject

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

#strategiesObject

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

#clearObject

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