lib/outbox/messages/email.rb in outbox-0.1.0 vs lib/outbox/messages/email.rb in outbox-0.1.1

- old
+ new

@@ -37,21 +37,23 @@ :message_id, :mime_version, :received, :references, :reply_to, :resent_bcc, :resent_cc, :resent_date, :resent_from, :resent_message_id, :resent_sender, :resent_to, :return_path, :sender, :to, :comments, :subject, accessor: false - def initialize(fields = nil, &block) + undef :body=, :[], :[]= + + def initialize(fields = nil, &block) # :nodoc: @message = ::Mail::Message.new super end # Returns the internal Mail::Message instance def message_object @message end - def audience=(audience) + def audience=(audience) # :nodoc: case audience when String, Array self.to = audience else audience = Outbox::Accessor.new(audience) @@ -59,19 +61,21 @@ self.cc = audience[:cc] self.bcc = audience[:bcc] end end + protected + def method_missing(method, *args, &block) if @message.respond_to?(method) @message.public_send(method, *args, &block) else super end end def respond_to_missing?(method, include_private = false) - @message.respond_to?(method, include_private) || super + super || @message.respond_to?(method, include_private) end end end end