Class: Feedigest::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/feedigest/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Config

Returns a new instance of Config.



6
7
8
# File 'lib/feedigest/config.rb', line 6

def initialize(path)
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



4
5
6
# File 'lib/feedigest/config.rb', line 4

def path
  @path
end

Instance Method Details

#fetch(key) ⇒ Object



10
11
12
# File 'lib/feedigest/config.rb', line 10

def fetch(key)
  options.fetch(key) # Delegate
end

#mail_gem_smtp_optionsObject

Translate SMTP options of feedigest for Mail gem



24
25
26
27
28
29
30
31
32
33
# File 'lib/feedigest/config.rb', line 24

def mail_gem_smtp_options
  {
    address: options.fetch(:smtp_address),
    port: options.fetch(:smtp_port),
    user_name: options.fetch(:smtp_username),
    password: options.fetch(:smtp_password),
    authentication: options.fetch(:smtp_auth),
    enable_starttls: options.fetch(:smtp_starttls)
  }
end

#optionsObject



14
15
16
17
18
19
20
21
# File 'lib/feedigest/config.rb', line 14

def options
  return @options if @options

  @options = default_options.merge(user_options)
  @options[:smtp_starttls] = @options[:smtp_starttls] == 'true'

  @options
end