Class: LadyJosephine::Whitelist
- Inherits:
-
Object
- Object
- LadyJosephine::Whitelist
- Includes:
- Singleton
- Defined in:
- lib/lady_josephine/whitelist.rb
Instance Method Summary collapse
-
#initialize ⇒ Whitelist
constructor
A new instance of Whitelist.
- #is_whitelisted?(class_to_check) ⇒ Boolean
- #whitelist(class_to_add) ⇒ Object
Constructor Details
#initialize ⇒ Whitelist
Returns a new instance of Whitelist.
5 6 7 |
# File 'lib/lady_josephine/whitelist.rb', line 5 def initialize @whitelist_classes = [] end |
Instance Method Details
#is_whitelisted?(class_to_check) ⇒ Boolean
17 18 19 20 21 22 23 |
# File 'lib/lady_josephine/whitelist.rb', line 17 def is_whitelisted?(class_to_check) if class_to_check.instance_of? String @whitelist_classes.include? class_to_check.classify else @whitelist_classes.include? class_to_check.to_s end end |
#whitelist(class_to_add) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/lady_josephine/whitelist.rb', line 9 def whitelist(class_to_add) if class_to_add.instance_of? String @whitelist_classes << class_to_add else @whitelist_classes << class_to_add.to_s end end |