Class: Freya::Email

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/freya.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject



42
43
44
# File 'lib/freya.rb', line 42

def body
  Template.new[name]
end


27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/freya.rb', line 27

def link
  extras = %w{ cc bcc body subject }.select { |extra| send(extra).present? }.map { |extra| [extra, send(extra)] }.map { |extra|
    name = extra[0]
    value = extra[1]

    [value].flatten.map do |component|
      "#{name}=#{Rack::Utils.escape_path(component)}"
    end
  }.compact

  extras = extras.empty? ? '' : '?' + extras.join('&')

  "#{to}#{extras}"
end