Class: Resque::Mcp::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#allowed_hostsObject



24
25
26
27
# File 'lib/resque/mcp/configuration.rb', line 24

def allowed_hosts
  list = (defined?(@allowed_hosts) && @allowed_hosts) ? @allowed_hosts : default_allowed_hosts&.call
  Array(list).select { |h| h.is_a?(String) && !h.start_with?(".") }
end

#allowed_originsObject



29
30
31
# File 'lib/resque/mcp/configuration.rb', line 29

def allowed_origins
  @allowed_origins || []
end

#auth_tokenObject

Returns the value of attribute auth_token.



6
7
8
# File 'lib/resque/mcp/configuration.rb', line 6

def auth_token
  @auth_token
end

#default_allowed_hostsObject

Internal seam: a callable returning the host's config.hosts, read lazily (the engine wires it) so post-boot changes are never missed.



22
23
24
# File 'lib/resque/mcp/configuration.rb', line 22

def default_allowed_hosts
  @default_allowed_hosts
end

#default_filter_parametersObject

Internal seam: a callable returning the host's filter list, read lazily so late additions to Rails' list (or other engines' after_initialize hooks) are never missed.



51
52
53
# File 'lib/resque/mcp/configuration.rb', line 51

def default_filter_parameters
  @default_filter_parameters
end

#filter_parametersObject

nil = inherit the host default (the engine wires Rails' filter_parameters as a lazy source); an explicit list replaces it ([] disables filtering).



47
48
49
# File 'lib/resque/mcp/configuration.rb', line 47

def filter_parameters
  @filter_parameters
end

#mcp_transport_optionsObject



40
41
42
# File 'lib/resque/mcp/configuration.rb', line 40

def mcp_transport_options
  @mcp_transport_options || {}
end

Instance Method Details

#param_filterObject

Memoized against the effective list, so both reassignment and in-place mutation (config.filter_parameters << :iban) take effect.



55
56
57
58
59
60
61
62
# File 'lib/resque/mcp/configuration.rb', line 55

def param_filter
  list = filter_parameters || default_filter_parameters&.call || []
  unless defined?(@param_filter) && @param_filter_list == list
    @param_filter_list = list.dup
    @param_filter = ActiveSupport::ParameterFilter.new(list)
  end
  @param_filter
end