Class: Land::Config

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



10
11
12
13
# File 'lib/land/config.rb', line 10

def initialize
  @enabled = false
  @secure_cookie = false
end

Instance Attribute Details

#blank_user_agent_stringObject



15
16
17
# File 'lib/land/config.rb', line 15

def blank_user_agent_string
  @blank_user_agent_string ||= 'user agent missing'
end

#enabledObject

Returns the value of attribute enabled.



5
6
7
# File 'lib/land/config.rb', line 5

def enabled
  @enabled
end

#schemaObject



31
32
33
# File 'lib/land/config.rb', line 31

def schema
  @schema ||= 'land'
end

Returns the value of attribute secure_cookie.



5
6
7
# File 'lib/land/config.rb', line 5

def secure_cookie
  @secure_cookie
end

#untracked_ipsObject



35
36
37
# File 'lib/land/config.rb', line 35

def untracked_ips
  @untracked_ips ||= []
end

#untracked_pathsObject



43
44
45
# File 'lib/land/config.rb', line 43

def untracked_paths
  @untracked_paths ||= []
end

Instance Method Details

#add_untracked_ip(ip) ⇒ Object



39
40
41
# File 'lib/land/config.rb', line 39

def add_untracked_ip(ip)
  @untracked_ips << ip
end

#add_untracked_path(path) ⇒ Object



47
48
49
# File 'lib/land/config.rb', line 47

def add_untracked_path(path)
  @untracked_paths << path
end

#visit_timeoutObject



51
52
53
# File 'lib/land/config.rb', line 51

def visit_timeout
  @visit_timeout ||= 30.minutes
end

#visit_timeout=(value) ⇒ Object

Raises:

  • (ArgumentError)


55
56
57
58
59
60
# File 'lib/land/config.rb', line 55

def visit_timeout=(value)
  raise ArgumentError unless [Integer, ActiveSupport::Duration].include?(value.class)
  raise ArgumentError, "must be positive" unless value.positive?

  @visit_timeout = value
end