Can I conditionaly initializer?

Hello, I’m trying to add to spree functionlity
gateway of china, I check out the documentation and
follow the spree_gateway, in engine.rb

initializer “spree.gateway.payment_methods”, :after =>
“spree.register.payment_methods” do |app|
app.config.spree.payment_methods <<
app.config.spree.payment_methods << Spree::Gateway::AuthorizeNet
app.config.spree.payment_methods << Spree::Gateway::Eway
app.config.spree.payment_methods << Spree::Gateway::Linkpoint
app.config.spree.payment_methods << Spree::Gateway::PayPal
app.config.spree.payment_methods << Spree::Gateway::SagePay
app.config.spree.payment_methods << Spree::Gateway::Beanstream
app.config.spree.payment_methods << Spree::Gateway::Braintree
app.config.spree.payment_methods << Spree::Gateway::Stripe
app.config.spree.payment_methods << Spree::Gateway::Samurai

so my,

initializer “spree.gateway.payment_methods_china”, :after => "
spree.gateway.payment_methods" do |app|
app.config.spree.payment_methods << Spree::Gateway::Alipay

I hope to write my gem more general,
so when spree_gateway exists
I initializer “spree.gateway.payment_methods_china”, :after => "
when spree_gateway doesn’t exist,
I initializer “spree.gateway.payment_methods_china”, :after => "

is it possible for rails engine to some kind conditionally say whether
a initializer
block exists?
(of course it doesn’t matter in my case, my payment gateway registers
before spree_gateway is also ok,
but is it possible to have this flexibility?

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs