class Puma::UserFileDefaultOptions
Experimental RBS support (using type sampling data from the type_fusion
project).
# sig/puma/configuration.rbs class Puma::UserFileDefaultOptions def []: (Symbol key) -> true? def fetch: (Symbol key, ?nil default_value) -> Float end
via calls to ‘finalize_values`
The “default” options can be set via procs. These are resolved during runtime
# => “sup.rb”
puts options[:rackup]<br>options.file_options = “sup.rb”
options = UserFileDefaultOptions.new(user_options, default_options)
default_options = { rackup: “zoo.rb” }
user_options = { foo: “bar” }
but will defer to any available “user” specified options.
A “file” option can be set. This config will be preferred over “default” options
# => [“bar”, “zoo”]
puts options.all_of(:foo)
All values can be accessed via `all_of`
# => “bar”
puts options[:foo]
options = UserFileDefaultOptions.new(user_options, default_options)
default_options = { foo: “zoo” }
user_options = { foo: “bar” }
User input is preferred over “defaults”:
“file” specified options, take precedence over any “default” options.
In this class any “user” specified options take precedence over any
A class used for storing “leveled” configuration options.
def [](key)
Experimental RBS support (using type sampling data from the type_fusion
project).
def []: (Symbol key) -> true?
This signature was generated using 2 samples from 1 application.
def [](key) fetch(key) end
def []=(key, value)
def []=(key, value) user_options[key] = value end
def all_of(key)
def all_of(key) user = user_options[key] file = file_options[key] default = default_options[key] user = [user] unless user.is_a?(Array) file = [file] unless file.is_a?(Array) default = [default] unless default.is_a?(Array) user.compact! file.compact! default.compact! user + file + default end
def fetch(key, default_value = nil)
Experimental RBS support (using type sampling data from the type_fusion
project).
def fetch: (Symbol key, ?nil default_value) -> Float
This signature was generated using 1 sample from 1 application.
def fetch(key, default_value = nil) return user_options[key] if user_options.key?(key) return file_options[key] if file_options.key?(key) return default_options[key] if default_options.key?(key) default_value end
def final_options
def final_options default_options .merge(file_options) .merge(user_options) end
def finalize_values
def finalize_values @default_options.each do |k,v| if v.respond_to? :call @default_options[k] = v.call end end end
def initialize(user_options, default_options)
def initialize(user_options, default_options) @user_options = user_options @file_options = {} @default_options = default_options end