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
#initialize(type, style) ⇒ SassCache
Returns a new instance of SassCache.
13 14 15 16 17 18 19 |
# File 'lib/bootstrap-email/sass_cache.rb', line 13 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
#checksum ⇒ Object
Returns the value of attribute checksum.
11 12 13 |
# File 'lib/bootstrap-email/sass_cache.rb', line 11 def checksum @checksum end |
#config_file ⇒ Object
Returns the value of attribute config_file.
11 12 13 |
# File 'lib/bootstrap-email/sass_cache.rb', line 11 def config_file @config_file end |
#file_path ⇒ Object
Returns the value of attribute file_path.
11 12 13 |
# File 'lib/bootstrap-email/sass_cache.rb', line 11 def file_path @file_path end |
#style ⇒ Object
Returns the value of attribute style.
11 12 13 |
# File 'lib/bootstrap-email/sass_cache.rb', line 11 def style @style end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/bootstrap-email/sass_cache.rb', line 11 def type @type end |
Class Method Details
.compile(type, style: :compressed) ⇒ Object
7 8 9 |
# File 'lib/bootstrap-email/sass_cache.rb', line 7 def self.compile(type, style: :compressed) new(type, style).compile end |
Instance Method Details
#cache_dir ⇒ Object
21 22 23 |
# File 'lib/bootstrap-email/sass_cache.rb', line 21 def cache_dir BootstrapEmail.config.sass_cache_location end |
#compile ⇒ Object
25 26 27 28 29 |
# File 'lib/bootstrap-email/sass_cache.rb', line 25 def compile cache_path = "#{cache_dir}/#{checksum}/#{type}.css" compile_and_cache_scss(cache_path) unless cached?(cache_path) File.read(cache_path) end |