2.2.0 "Types and types again"
Features
- Add type coercion support.
Example:
class CoolConfig < Anyway::Config
attr_config :port, :user
coerce_types port: :string, user: {dob: :date}
end
ENV["COOL_USER__DOB"] = "1989-07-01"
config = CoolConfig.new({port: 8080})
config.port == "8080" #=> true
config.user["dob"] == Date.new(1989, 7, 1) #=> true
You can also add .disable_auto_cast! to your config class to disable automatic conversion.
- Add RBS signatures and generator.
Anyway Config now ships with the basic RBS support. To use config types with Steep, add library "anyway_config" to your Steepfile.
We also provide an API to generate a signature for you config class: MyConfig.to_rbs. You can use this method to generate a scaffold for your config class.