Class: BootstrapEmail::Compiler

Inherits:
Object
  • Object
show all
Defined in:
lib/bootstrap-email/compiler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(input, type: :string, options: {}) ⇒ Compiler

Returns a new instance of Compiler.

[View source]

5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bootstrap-email/compiler.rb', line 5

def initialize(input, type: :string, options: {})
  BootstrapEmail.load_options(options)
  self.type = type
  case type
  when :rails
    @mail = input
    html = (@mail.html_part || @mail).body.raw_source
  when :string
    html = input
  when :file
    html = File.read(input)
  end
  html = add_layout!(html)
  sass_load_paths
  build_premailer_doc(html)
end

Instance Attribute Details

#docObject

Returns the value of attribute doc.


3
4
5
# File 'lib/bootstrap-email/compiler.rb', line 3

def doc
  @doc
end

#premailerObject

Returns the value of attribute premailer.


3
4
5
# File 'lib/bootstrap-email/compiler.rb', line 3

def premailer
  @premailer
end

#typeObject

Returns the value of attribute type.


3
4
5
# File 'lib/bootstrap-email/compiler.rb', line 3

def type
  @type
end

Instance Method Details

#perform_full_compileObject

[View source]

22
23
24
25
26
27
# File 'lib/bootstrap-email/compiler.rb', line 22

def perform_full_compile
  compile_html!
  inline_css!
  configure_html!
  finalize_document!
end