Class: BootstrapEmail::SassCache
- Inherits:
-
Object
- Object
- BootstrapEmail::SassCache
- Defined in:
- lib/bootstrap-email/sass_cache.rb
Constant Summary collapse
- SASS_DIR =
File.('../../core', __dir__)
Instance Attribute Summary collapse
-
#checksum ⇒ Object
Returns the value of attribute checksum.
-
#config_file ⇒ Object
Returns the value of attribute config_file.
-
#file_path ⇒ Object
Returns the value of attribute file_path.
-
#style ⇒ Object
Returns the value of attribute style.
-
#type ⇒ Object
Returns the value of attribute type.
Class Method Summary collapse
Instance Method Summary collapse
- #cache_dir ⇒ Object
- #compile ⇒ Object
-
#initialize(type, style) ⇒ SassCache
constructor
A new instance of SassCache.
Constructor Details
permalink #initialize(type, style) ⇒ SassCache
Returns a new instance of SassCache.
11 12 13 14 15 16 17 |
# File 'lib/bootstrap-email/sass_cache.rb', line 11 def initialize(type, style) self.type = type self.style = style self.file_path = "#{SASS_DIR}/#{type}" self.config_file = load_config self.checksum = checksum_files end |
Instance Attribute Details
permalink #checksum ⇒ Object
Returns the value of attribute checksum.
9 10 11 |
# File 'lib/bootstrap-email/sass_cache.rb', line 9 def checksum @checksum end |
permalink #config_file ⇒ Object
Returns the value of attribute config_file.
9 10 11 |
# File 'lib/bootstrap-email/sass_cache.rb', line 9 def config_file @config_file end |
permalink #file_path ⇒ Object
Returns the value of attribute file_path.
9 10 11 |
# File 'lib/bootstrap-email/sass_cache.rb', line 9 def file_path @file_path end |
permalink #style ⇒ Object
Returns the value of attribute style.
9 10 11 |
# File 'lib/bootstrap-email/sass_cache.rb', line 9 def style @style end |
permalink #type ⇒ Object
Returns the value of attribute type.
9 10 11 |
# File 'lib/bootstrap-email/sass_cache.rb', line 9 def type @type end |
Class Method Details
permalink .compile(type, style: :compressed) ⇒ Object
[View source]
5 6 7 |
# File 'lib/bootstrap-email/sass_cache.rb', line 5 def self.compile(type, style: :compressed) new(type, style).compile end |
Instance Method Details
permalink #cache_dir ⇒ Object
[View source]
19 20 21 |
# File 'lib/bootstrap-email/sass_cache.rb', line 19 def cache_dir BootstrapEmail.config.sass_cache_location end |
permalink #compile ⇒ Object
[View source]
23 24 25 26 27 28 29 |
# File 'lib/bootstrap-email/sass_cache.rb', line 23 def compile cache_path = "#{cache_dir}/#{checksum}/#{type}.css" unless cached?(cache_path) compile_and_cache_scss(cache_path) end File.read(cache_path) end |