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.
98 99 100 101 102 103 104 105 106 |
# File 'lib/vernier/output/firefox.rb', line 98 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.
96 97 98 |
# File 'lib/vernier/output/firefox.rb', line 96 def color @color end |
#idx ⇒ Object (readonly)
Returns the value of attribute idx.
96 97 98 |
# File 'lib/vernier/output/firefox.rb', line 96 def idx @idx end |
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
96 97 98 |
# File 'lib/vernier/output/firefox.rb', line 96 def matcher @matcher end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
96 97 98 |
# File 'lib/vernier/output/firefox.rb', line 96 def name @name end |
#subcategories ⇒ Object (readonly)
Returns the value of attribute subcategories.
96 97 98 |
# File 'lib/vernier/output/firefox.rb', line 96 def subcategories @subcategories end |
Instance Method Details
#add_subcategory(**args) ⇒ Object
108 109 110 |
# File 'lib/vernier/output/firefox.rb', line 108 def add_subcategory(**args) @subcategories << Category.new(@subcategories.size, color: nil, **args) end |
#matches?(path) ⇒ Boolean
112 113 114 |
# File 'lib/vernier/output/firefox.rb', line 112 def matches?(path) @matcher && @matcher === path end |