Class: DisplayCase::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/display_case/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



38
39
40
41
42
43
44
45
46
# File 'lib/display_case/configuration.rb', line 38

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_storeObject

A cache store which responds to ‘fetch(key, options, &block)`



25
26
27
# File 'lib/display_case/configuration.rb', line 25

def cache_store
  @cache_store
end

#definition_file_pathsObject

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.



22
23
24
# File 'lib/display_case/configuration.rb', line 22

def definition_file_paths
  @definition_file_paths
end

#explicitObject

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.



17
18
19
# File 'lib/display_case/configuration.rb', line 17

def explicit
  @explicit
end

#logging_enabledObject

A boolean indicating whether or not to log to the Rails logger



28
29
30
# File 'lib/display_case/configuration.rb', line 28

def logging_enabled
  @logging_enabled
end

#smart_matchingObject

A boolean indicating whether Exhibits with names that are similar to context should be favored over other exhibits. By default, this is true



32
33
34
# File 'lib/display_case/configuration.rb', line 32

def smart_matching
  @smart_matching
end

#swallow_superclass_mismatch_for_exhibitsObject

A boolean indicating whether DisplayCase will swallow superclass mismatch errors (see README for more info). By default, this is false.



36
37
38
# File 'lib/display_case/configuration.rb', line 36

def swallow_superclass_mismatch_for_exhibits
  @swallow_superclass_mismatch_for_exhibits
end

Instance Method Details

#exhibitsObject



64
65
66
# File 'lib/display_case/configuration.rb', line 64

def exhibits
  [DisplayCase::Exhibit::Exhibited,DisplayCase::BasicExhibit,DisplayCase::EnumerableExhibit] + @exhibits
end

#exhibits=(val) ⇒ Object



68
69
70
# File 'lib/display_case/configuration.rb', line 68

def exhibits=(val)
  @exhibits = Array(val)
end

#explicit?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/display_case/configuration.rb', line 48

def explicit?
  explicit
end

#logging_enabled?Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/display_case/configuration.rb', line 60

def logging_enabled?
  defined? ::Rails and logging_enabled
end

#smart_matching?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/display_case/configuration.rb', line 52

def smart_matching?
  smart_matching
end

#swallow_superclass_mismatch_for_exhibits?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/display_case/configuration.rb', line 56

def swallow_superclass_mismatch_for_exhibits?
  swallow_superclass_mismatch_for_exhibits
end