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 main sass file.
- #sass_load_paths ⇒ Object
-
#sass_log_enabled ⇒ Object
writeonly
path to main sass file.
Instance Method Summary collapse
Instance Attribute Details
#sass_cache_location ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/bootstrap-email/config.rb', line 36 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
5 6 7 |
# File 'lib/bootstrap-email/config.rb', line 5 def sass_email_location=(value) @sass_email_location = value end |
#sass_head_location=(value) ⇒ Object (writeonly)
path to main sass file
5 6 7 |
# File 'lib/bootstrap-email/config.rb', line 5 def sass_head_location=(value) @sass_head_location = value end |
#sass_load_paths ⇒ Object
30 31 32 33 34 |
# File 'lib/bootstrap-email/config.rb', line 30 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)
path to main sass file
5 6 7 |
# File 'lib/bootstrap-email/config.rb', line 5 def sass_log_enabled=(value) @sass_log_enabled = value end |
Instance Method Details
#load_options(options) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/bootstrap-email/config.rb', line 11 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
21 22 23 24 25 26 27 28 |
# File 'lib/bootstrap-email/config.rb', line 21 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
48 49 50 |
# File 'lib/bootstrap-email/config.rb', line 48 def sass_log_enabled? defined?(@sass_log_enabled) ? @sass_log_enabled : true end |