Class: DisplayCase::Configuration
- Inherits:
-
Object
- Object
- DisplayCase::Configuration
- Defined in:
- lib/display_case/configuration.rb
Instance Attribute Summary collapse
-
#cache_store ⇒ Object
A cache store which responds to ‘fetch(key, options, &block)`.
-
#definition_file_paths ⇒ Object
An Array of strings specifying locations that should be searched for exhibit classes and definitions.
-
#explicit ⇒ Object
A boolean indicating whether the Exhibits will be explicitly listed in order or dynamically collected with the inherited callback.
-
#logging_enabled ⇒ Object
A boolean indicating whether or not to log to the Rails logger.
-
#smart_matching ⇒ Object
A boolean indicating whether Exhibits with names that are similar to context should be favored over other exhibits.
-
#swallow_superclass_mismatch_for_exhibits ⇒ Object
A boolean indicating whether DisplayCase will swallow superclass mismatch errors (see README for more info).
Instance Method Summary collapse
- #exhibits ⇒ Object
- #exhibits=(val) ⇒ Object
- #explicit? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #logging_enabled? ⇒ Boolean
- #smart_matching? ⇒ Boolean
- #swallow_superclass_mismatch_for_exhibits? ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
36 37 38 39 40 41 42 43 44 |
# File 'lib/display_case/configuration.rb', line 36 def initialize @definition_file_paths = %w(app/exhibits) @explicit = false @exhibits = [] @cache_store = nil @logging_enabled = false @smart_matching = true @swallow_superclass_mismatch_for_exhibits = false end |
Instance Attribute Details
#cache_store ⇒ Object
A cache store which responds to ‘fetch(key, options, &block)`
23 24 25 |
# File 'lib/display_case/configuration.rb', line 23 def cache_store @cache_store end |
#definition_file_paths ⇒ Object
An Array of strings specifying locations that should be searched for exhibit classes and definitions. By default, “/app/exhibits” will be searched and existing file will be loaded.
20 21 22 |
# File 'lib/display_case/configuration.rb', line 20 def definition_file_paths @definition_file_paths end |
#explicit ⇒ Object
A boolean indicating whether the Exhibits will be explicitly listed in order or dynamically collected with the inherited callback. By default, this is false and the list will be generated via the inherited callback.
15 16 17 |
# File 'lib/display_case/configuration.rb', line 15 def explicit @explicit end |
#logging_enabled ⇒ Object
A boolean indicating whether or not to log to the Rails logger
26 27 28 |
# File 'lib/display_case/configuration.rb', line 26 def logging_enabled @logging_enabled end |
#smart_matching ⇒ Object
A boolean indicating whether Exhibits with names that are similar to context should be favored over other exhibits. By default, this is true
30 31 32 |
# File 'lib/display_case/configuration.rb', line 30 def smart_matching @smart_matching end |
#swallow_superclass_mismatch_for_exhibits ⇒ Object
A boolean indicating whether DisplayCase will swallow superclass mismatch errors (see README for more info). By default, this is false.
34 35 36 |
# File 'lib/display_case/configuration.rb', line 34 def swallow_superclass_mismatch_for_exhibits @swallow_superclass_mismatch_for_exhibits end |
Instance Method Details
#exhibits ⇒ Object
62 63 64 |
# File 'lib/display_case/configuration.rb', line 62 def exhibits [DisplayCase::Exhibit::Exhibited,DisplayCase::BasicExhibit,DisplayCase::EnumerableExhibit] + @exhibits end |
#exhibits=(val) ⇒ Object
66 67 68 69 70 |
# File 'lib/display_case/configuration.rb', line 66 def exhibits=(val) @exhibits = Array(val) DisplayCase::Exhibit.initialize_exhibits @exhibits end |
#explicit? ⇒ Boolean
46 47 48 |
# File 'lib/display_case/configuration.rb', line 46 def explicit? explicit end |
#logging_enabled? ⇒ Boolean
58 59 60 |
# File 'lib/display_case/configuration.rb', line 58 def logging_enabled? defined? ::Rails and logging_enabled end |
#smart_matching? ⇒ Boolean
50 51 52 |
# File 'lib/display_case/configuration.rb', line 50 def smart_matching? smart_matching end |
#swallow_superclass_mismatch_for_exhibits? ⇒ Boolean
54 55 56 |
# File 'lib/display_case/configuration.rb', line 54 def swallow_superclass_mismatch_for_exhibits? swallow_superclass_mismatch_for_exhibits end |