Class: BootstrapEmail::Config
- Inherits:
-
Object
- Object
- BootstrapEmail::Config
- Defined in:
- lib/bootstrap-email/config.rb
Instance Attribute Summary collapse
- #sass_cache_location ⇒ Object
-
#sass_email_location ⇒ Object
writeonly
path to main sass file.
-
#sass_head_location ⇒ Object
writeonly
path to head sass file.
- #sass_load_paths ⇒ Object
-
#sass_log_enabled ⇒ Object
writeonly
turn on or off sass log when caching new sass.
Instance Method Summary collapse
Instance Attribute Details
#sass_cache_location ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/bootstrap-email/config.rb', line 34 def sass_cache_location @sass_cache_location ||= begin if defined?(::Rails) && ::Rails.root ::Rails.root.join('tmp', 'cache', 'bootstrap-email', '.sass-cache') elsif File.writable?(Dir.pwd) File.join(Dir.pwd, '.sass-cache', 'bootstrap-email') else File.join(Dir.tmpdir, '.sass-cache', 'bootstrap-email') end end end |
#sass_email_location=(value) ⇒ Object (writeonly)
path to main sass file
3 4 5 |
# File 'lib/bootstrap-email/config.rb', line 3 def sass_email_location=(value) @sass_email_location = value end |
#sass_head_location=(value) ⇒ Object (writeonly)
path to head sass file
4 5 6 |
# File 'lib/bootstrap-email/config.rb', line 4 def sass_head_location=(value) @sass_head_location = value end |
#sass_load_paths ⇒ Object
28 29 30 31 32 |
# File 'lib/bootstrap-email/config.rb', line 28 def sass_load_paths paths_array = [SassCache::SASS_DIR] @sass_load_paths ||= [] paths_array.concat(@sass_load_paths) end |
#sass_log_enabled=(value) ⇒ Object (writeonly)
turn on or off sass log when caching new sass
7 8 9 |
# File 'lib/bootstrap-email/config.rb', line 7 def sass_log_enabled=(value) @sass_log_enabled = value end |
Instance Method Details
#load_options(options) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/bootstrap-email/config.rb', line 9 def () file = File.('bootstrap-email.config.rb', Dir.pwd) if [:config_path] require_relative [:config_path] elsif File.exist?(file) require_relative file end .each { |name, value| instance_variable_set("@#{name}", value) } end |
#sass_location_for(type:) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/bootstrap-email/config.rb', line 19 def sass_location_for(type:) ivar = instance_variable_get("@sass_#{type.sub('bootstrap-', '')}_location") return ivar if ivar lookup_locations = ["#{type}.scss", "app/assets/stylesheets/#{type}.scss"] locations = lookup_locations.map { |location| File.(location, Dir.pwd) }.select { |location| File.exist?(location) } locations.first if locations.any? end |
#sass_log_enabled? ⇒ Boolean
46 47 48 |
# File 'lib/bootstrap-email/config.rb', line 46 def sass_log_enabled? defined?(@sass_log_enabled) ? @sass_log_enabled : true end |