Class: Defmastership::DefTypeList
- Inherits:
-
Object
- Object
- Defmastership::DefTypeList
- Defined in:
- lib/defmastership/def_type_list.rb
Overview
Handle the possible configurations of def_type
Instance Method Summary collapse
-
#include?(def_type) ⇒ Boolean
True if the type is included in the DefTypeList instance.
-
#initialize(def_type_config) ⇒ DefTypeList
constructor
A new instance of DefTypeList.
Constructor Details
#initialize(def_type_config) ⇒ DefTypeList
Returns a new instance of DefTypeList.
8 9 10 11 12 13 14 |
# File 'lib/defmastership/def_type_list.rb', line 8 def initialize(def_type_config) if ['', 'all'].include?(def_type_config) @allow_all = true else @allowed_types = Array(def_type_config) end end |
Instance Method Details
#include?(def_type) ⇒ Boolean
Returns true if the type is included in the DefTypeList instance.
19 20 21 22 23 |
# File 'lib/defmastership/def_type_list.rb', line 19 def include?(def_type) return true if @allow_all @allowed_types.include?(def_type) end |