lib/landable/configuration.rb in landable-1.13.1 vs lib/landable/configuration.rb in landable-1.13.2

- old
+ new

@@ -1,14 +1,14 @@ module Landable class Configuration - attr_accessor :api_url, :public_url, :amqp_configuration + attr_accessor :api_url, :public_url, :amqp_configuration, :sitemap_host attr_writer :api_namespace, :public_namespace attr_writer :api_host, :public_host attr_writer :categories attr_writer :screenshots_enabled attr_writer :traffic_enabled - attr_writer :sitemap_exclude_categories, :sitemap_protocol, :sitemap_host, :sitemap_additional_paths + attr_writer :sitemap_exclude_categories, :sitemap_protocol, :sitemap_additional_paths attr_writer :reserved_paths, :partials_to_templates, :database_schema_prefix attr_writer :publicist_url, :audit_flags attr_writer :blank_user_agent_string, :untracked_paths attr_writer :dnt_enabled, :amqp_event_mapping, :amqp_site_segment attr_writer :amqp_service_enabled, :amqp_messaging_service @@ -16,27 +16,25 @@ def amqp_configuration @amqp_configuration ||= {} end def authenticators - @authenticators || raise("No Landable authenticator configured.") + @authenticators || fail('No Landable authenticator configured.') end def authenticators=(authenticators) @authenticators = Array(authenticators) end - alias :authenticator= :authenticators= + alias_method :authenticator=, :authenticators= def publicist_url @publicist_url ||= 'publicist.dev' end def api_uri - if api_url.present? - @api_uri ||= URI(api_url) - end + @api_uri ||= URI(api_url) if api_url.present? end def api_host @api_host ||= api_uri.try(:host) end @@ -44,13 +42,11 @@ def api_namespace @api_namespace ||= (api_uri.try(:path).presence || '/api/landable') end def public_uri - if public_url.present? - @public_uri ||= URI(public_url) - end + @public_uri ||= URI(public_url) if public_url.present? end def public_host @public_host ||= public_uri.try(:host) end @@ -77,11 +73,11 @@ 'Affiliates' => '', 'PPC' => 'Pay-per-click', 'SEO' => 'Search engine optimization', 'Social' => '', 'Email' => '', - 'Traditional' => '', + 'Traditional' => '' } end def partials_to_templates @partials_to_templates ||= [] @@ -98,36 +94,32 @@ def sitemap_additional_paths @sitemap_additional_paths ||= [] end def sitemap_protocol - @sitemap_protocol ||= "http" + @sitemap_protocol ||= 'http' end - def sitemap_host - @sitemap_host - end - def screenshots_enabled @screenshots_enabled ||= false end def traffic_enabled @traffic_enabled ||= false end def traffic_enabled=(val) - raise ArgumentError.new("Landable::Configuration#traffic_enabled accepts false, true, :all or :html") unless [true, false, :all, :html].include? val + fail(ArgumentError, 'Landable::Configuration#traffic_enabled accepts false, true, :all or :html') unless [true, false, :all, :html].include? val @traffic_enabled = val end def cors @cors ||= CORS.new end def cors=(bool) - raise ArgumentError.new("Landable::Configuration#cors should be assigned 'false' to disable CORS support") if bool != false + fail(ArgumentError, "Landable::Configuration#cors should be assigned 'false' to disable CORS support") if bool != false cors.origins = [] end class CORS def enabled? @@ -169,10 +161,9 @@ end def amqp_service_enabled amqp_configuration[:enabled] && amqp_configuration[:messaging_service] end - class Screenshots attr_accessor :autorun attr_accessor :browserstack_username, :browserstack_password