Class: Wallaby::Configuration::Models
- Inherits:
-
Object
- Object
- Wallaby::Configuration::Models
- Defined in:
- lib/wallaby/configuration/models.rb
Overview
Configuration for the model classes that Wallaby should handle > NOTE: In ‘devlopment` environment, Rails recreates module/class > constants on reload event. If we cache constants, they will become > stale and raise conflicts. > Hence, we need to storing name strings instead of constants.
Instance Method Summary collapse
-
#exclude(*models) ⇒ Object
Specify the model classes that user wants to exclude.
-
#excludes ⇒ Array<Class>
The list of models that user has configured.
-
#presence ⇒ Array<Class>?
The list of models that user has configured.
-
#set(*models) ⇒ Object
Specify the model classes that Wallaby should handle.
Instance Method Details
#exclude(*models) ⇒ Object
Specify the model classes that user wants to exclude
22 23 24 |
# File 'lib/wallaby/configuration/models.rb', line 22 def exclude(*models) @excludes = Array(models).flatten.map(&:to_s) end |
#excludes ⇒ Array<Class>
Returns the list of models that user has configured.
27 28 29 |
# File 'lib/wallaby/configuration/models.rb', line 27 def excludes (@excludes ||= []).map(&:constantize) end |
#presence ⇒ Array<Class>?
Returns the list of models that user has configured.
16 17 18 |
# File 'lib/wallaby/configuration/models.rb', line 16 def presence (@models ||= []).map(&:constantize) end |
#set(*models) ⇒ Object
Specify the model classes that Wallaby should handle
11 12 13 |
# File 'lib/wallaby/configuration/models.rb', line 11 def set(*models) @models = Array(models).flatten.map(&:to_s) end |