Now we have a simple problem: how to set up default values for each abilities instance in one place?
I sugest to use something like this:
class ProjectAbilityApplication < Kan::Application
default_options logger: MyLogger.new
end
After that we can initialize:
- default application class
Kan::Application.new(
comment: Comments::Abilities.new
) # => will use default Logger
ProjectAbilityApplication.new(
comment: Comments::Abilities.new
) # => will use default MyLogger
- custom application class with other value
ProjectAbilityApplication.new(
comment: Comments::Abilities.new(logger: MyOtherLogger.new)
) # => will use MyOtherLogger
WDYT?
UPD agter small talk with @apotonick: Maybe we need to use instance variable for settings and #call for generating a builder class 🤔
Kan::Application.new.call(
comment: Comments::Abilities.new
) # => will use default Logger
Kan::Application.new(logger: MyLogger.new).call(
comment: Comments::Abilities.new
) # will use MyLogger
Kan::Application.new(logger: MyLogger.new).call(
comment: Comments::Abilities.new(logger: MyOtherLogger.new)
) # => will use MyOtherLogger
Now we have a simple problem: how to set up default values for each abilities instance in one place?
I sugest to use something like this:
After that we can initialize:
WDYT?
UPD agter small talk with @apotonick: Maybe we need to use instance variable for settings and
#callfor generating a builder class 🤔