Module: Detectify

Defined in:
lib/detectify.rb,
lib/detectify/config.rb,
lib/detectify/railtie.rb,
lib/detectify/version.rb,
lib/detectify/detector.rb,
lib/detectify/middleware.rb,
lib/detectify/query_builder/sql.rb,
lib/detectify/query_builder/base.rb,
lib/generators/detectify/install_generator.rb

Defined Under Namespace

Modules: Generators, QueryBuilder Classes: Config, Detector, Middleware, Railtie

Constant Summary collapse

VERSION =
'1.0.5'.freeze

Class Method Summary collapse

Class Method Details

.configObject



13
14
15
# File 'lib/detectify.rb', line 13

def self.config
  @config || reset_config
end

.configure {|config| ... } ⇒ Object

Yields:



9
10
11
# File 'lib/detectify.rb', line 9

def self.configure
  yield(config)
end

.entity_classObject



21
22
23
24
25
26
27
# File 'lib/detectify.rb', line 21

def self.entity_class
  if config.entity_class.is_a?(String)
    Object.const_get(config.entity_class)
  else
    config.entity_class
  end
end

.reset_config(config = Config.new) ⇒ Object



17
18
19
# File 'lib/detectify.rb', line 17

def self.reset_config(config = Config.new)
  @config = config
end