lib/hanami/mailer/glue.rb in hanami-0.9.2 vs lib/hanami/mailer/glue.rb in hanami-1.0.0.beta1
- old
+ new
@@ -1,56 +1,14 @@
-require 'hanami/utils/basic_object'
-
module Hanami::Mailer
# @since 0.5.0
# @api private
- class Delivery < ::Hanami::Utils::BasicObject
- # @since 0.5.0
- # @api private
- def initialize(env, &blk)
- @env = env
- instance_eval(&blk)
- end
-
- # @since 0.5.0
- # @api private
- def to_config
- @config
- end
-
- # @since 0.5.0
- # @api private
- def test(*args)
- __setup_config(:test, *args)
- end
-
- private
-
- # @since 0.5.0
- # @api private
- def method_missing(m, *args)
- __setup_config(m, *args)
- end
-
- # @since 0.5.0
- # @api private
- def __setup_config(env, *args)
- if env.to_s == @env
- @config = args
- end
- end
- end
-
-
- # @since 0.5.0
- # @api private
module Glue
-
# @since 0.5.0
# @api private
- def delivery(&blk)
- raise ArgumentError unless block_given?
- delivery_method(*Hanami::Mailer::Delivery.new(Hanami.env, &blk).to_config)
+ def self.included(configuration)
+ configuration.class_eval do
+ alias_method :delivery, :delivery_method
+ end
end
end
Configuration.class_eval do
include Glue