Class: Landable::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/landable/configuration.rb

Defined Under Namespace

Classes: CORS, Screenshots

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_hostObject



35
36
37
# File 'lib/landable/configuration.rb', line 35

def api_host
  @api_host ||= api_uri.try(:host)
end

#api_namespaceObject



39
40
41
# File 'lib/landable/configuration.rb', line 39

def api_namespace
  @api_namespace ||= (api_uri.try(:path).presence || '/api/landable')
end

#api_urlObject

Returns the value of attribute api_url.



3
4
5
# File 'lib/landable/configuration.rb', line 3

def api_url
  @api_url
end

#audit_flagsObject



53
54
55
# File 'lib/landable/configuration.rb', line 53

def audit_flags
  @audit_flags ||= []
end

#blank_user_agent_stringObject



145
146
147
# File 'lib/landable/configuration.rb', line 145

def blank_user_agent_string
  @blank_user_agent_string ||= 'blank'
end

#categoriesObject



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/landable/configuration.rb', line 69

def categories
  # default categories
  @categories ||= {
    'Affiliates' => '',
    'PPC' => 'Pay-per-click',
    'SEO' => 'Search engine optimization',
    'Social' => '',
    'Email' => '',
    'Traditional' => '',
  }
end

#database_schema_prefixObject



61
62
63
# File 'lib/landable/configuration.rb', line 61

def database_schema_prefix
  @database_schema_prefix ||= ''
end

#dnt_enabledObject



153
154
155
156
157
# File 'lib/landable/configuration.rb', line 153

def dnt_enabled
  return true if @dnt_enabled.nil?

  @dnt_enabled
end

#partials_to_templatesObject



81
82
83
# File 'lib/landable/configuration.rb', line 81

def partials_to_templates
  @partials_to_templates ||= []
end

#public_hostObject



49
50
51
# File 'lib/landable/configuration.rb', line 49

def public_host
  @public_host ||= public_uri.try(:host)
end

#public_namespaceObject



57
58
59
# File 'lib/landable/configuration.rb', line 57

def public_namespace
  @public_namespace ||= (public_uri.try(:path).presence || '')
end

#public_urlObject

Returns the value of attribute public_url.



3
4
5
# File 'lib/landable/configuration.rb', line 3

def public_url
  @public_url
end

#publicist_urlObject



25
26
27
# File 'lib/landable/configuration.rb', line 25

def publicist_url
  @publicist_url ||= 'publicist.dev'
end

#reserved_pathsObject



85
86
87
# File 'lib/landable/configuration.rb', line 85

def reserved_paths
  @reserved_paths ||= []
end

#screenshots_enabledObject



105
106
107
# File 'lib/landable/configuration.rb', line 105

def screenshots_enabled
  @screenshots_enabled ||= false
end

#sitemap_additional_pathsObject



93
94
95
# File 'lib/landable/configuration.rb', line 93

def sitemap_additional_paths
  @sitemap_additional_paths ||= []
end

#sitemap_exclude_categoriesObject



89
90
91
# File 'lib/landable/configuration.rb', line 89

def sitemap_exclude_categories
  @sitemap_exclude_categories ||= []
end

#sitemap_hostObject



101
102
103
# File 'lib/landable/configuration.rb', line 101

def sitemap_host
  @sitemap_host
end

#sitemap_protocolObject



97
98
99
# File 'lib/landable/configuration.rb', line 97

def sitemap_protocol
  @sitemap_protocol ||= "http"
end

#traffic_enabledObject



109
110
111
# File 'lib/landable/configuration.rb', line 109

def traffic_enabled
  @traffic_enabled ||= false
end

#untracked_pathsObject



149
150
151
# File 'lib/landable/configuration.rb', line 149

def untracked_paths
  @untracked_paths ||= []
end

Instance Method Details

#api_uriObject



29
30
31
32
33
# File 'lib/landable/configuration.rb', line 29

def api_uri
  if api_url.present?
    @api_uri ||= URI(api_url)
  end
end

#authenticatorsObject



15
16
17
# File 'lib/landable/configuration.rb', line 15

def authenticators
  @authenticators || raise("No Landable authenticator configured.")
end

#authenticators=(authenticators) ⇒ Object Also known as: authenticator=



19
20
21
# File 'lib/landable/configuration.rb', line 19

def authenticators=(authenticators)
  @authenticators = Array(authenticators)
end

#corsObject



118
119
120
# File 'lib/landable/configuration.rb', line 118

def cors
  @cors ||= CORS.new
end

#cors=(bool) ⇒ Object

Raises:

  • (ArgumentError)


122
123
124
125
# File 'lib/landable/configuration.rb', line 122

def cors=(bool)
  raise ArgumentError.new("Landable::Configuration#cors should be assigned 'false' to disable CORS support") if bool != false
  cors.origins = []
end

#public_uriObject



43
44
45
46
47
# File 'lib/landable/configuration.rb', line 43

def public_uri
  if public_url.present?
    @public_uri ||= URI(public_url)
  end
end

#screenshotsObject



141
142
143
# File 'lib/landable/configuration.rb', line 141

def screenshots
  @screenshots ||= Screenshots.new
end