Class: Vernier::Output::Firefox::Categorizer::Category
- Inherits:
-
Object
- Object
- Vernier::Output::Firefox::Categorizer::Category
- Defined in:
- lib/vernier/output/firefox.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#idx ⇒ Object
readonly
Returns the value of attribute idx.
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#subcategories ⇒ Object
readonly
Returns the value of attribute subcategories.
Instance Method Summary collapse
- #add_subcategory(**args) ⇒ Object
-
#initialize(idx, name:, color:, matcher: nil) ⇒ Category
constructor
A new instance of Category.
- #matches?(path) ⇒ Boolean
Constructor Details
#initialize(idx, name:, color:, matcher: nil) ⇒ Category
Returns a new instance of Category.
97 98 99 100 101 102 103 104 105 |
# File 'lib/vernier/output/firefox.rb', line 97 def initialize(idx, name:, color:, matcher: nil) raise ArgumentError, "invalid color: #{color}" if color && AVAILABLE_COLORS.none?(color) @idx = idx @name = name @color = color @matcher = matcher @subcategories = [] end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
95 96 97 |
# File 'lib/vernier/output/firefox.rb', line 95 def color @color end |
#idx ⇒ Object (readonly)
Returns the value of attribute idx.
95 96 97 |
# File 'lib/vernier/output/firefox.rb', line 95 def idx @idx end |
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
95 96 97 |
# File 'lib/vernier/output/firefox.rb', line 95 def matcher @matcher end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
95 96 97 |
# File 'lib/vernier/output/firefox.rb', line 95 def name @name end |
#subcategories ⇒ Object (readonly)
Returns the value of attribute subcategories.
95 96 97 |
# File 'lib/vernier/output/firefox.rb', line 95 def subcategories @subcategories end |
Instance Method Details
#add_subcategory(**args) ⇒ Object
107 108 109 |
# File 'lib/vernier/output/firefox.rb', line 107 def add_subcategory(**args) @subcategories << Category.new(@subcategories.size, color: nil, **args) end |
#matches?(path) ⇒ Boolean
111 112 113 |
# File 'lib/vernier/output/firefox.rb', line 111 def matches?(path) @matcher && @matcher === path end |