Module: Mail::YAML

Defined in:
lib/mail/yaml.rb

Class Method Summary collapse

Class Method Details

.load(yaml) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mail/yaml.rb', line 5

def self.load(yaml)
  permitted_classes = [
    Symbol,

    Mail::Body,

    # Delivery methods as listed in mail/configuration.rb
    Mail::SMTP,
    Mail::Sendmail,
    Mail::Exim,
    Mail::FileDelivery,
    Mail::SMTPConnection,
    Mail::TestMailer,
    Mail::LoggerDelivery,

    Mail.delivery_method.class,
  ]

  if Gem::Version.new(Psych::VERSION) >= Gem::Version.new('3.1.0.pre1')
    ::YAML.safe_load(yaml, :permitted_classes => permitted_classes)
  else
    ::YAML.safe_load(yaml, permitted_classes)
  end
end