Class: ConventionalCommits::Configuration::TypeConfiguration
- Inherits:
-
Object
- Object
- ConventionalCommits::Configuration::TypeConfiguration
- Defined in:
- lib/models/type_configuration.rb
Overview
Configuration for branch name policies
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #all_types ⇒ Object
-
#initialize(o = {}) ⇒ TypeConfiguration
constructor
A new instance of TypeConfiguration.
- #is_allowed(type) ⇒ Object
- #main_type(_type) ⇒ Object
Constructor Details
#initialize(o = {}) ⇒ TypeConfiguration
Returns a new instance of TypeConfiguration.
9 10 11 |
# File 'lib/models/type_configuration.rb', line 9 def initialize(o = {}) @options = o end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/models/type_configuration.rb', line 7 def @options end |
Instance Method Details
#all_types ⇒ Object
26 27 28 |
# File 'lib/models/type_configuration.rb', line 26 def all_types .keys + .values.flat_map { |e| e } end |
#is_allowed(type) ⇒ Object
13 14 15 |
# File 'lib/models/type_configuration.rb', line 13 def is_allowed(type) all_types.include?(type) end |
#main_type(_type) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/models/type_configuration.rb', line 17 def main_type(_type) match = "" .each do |key, array| match = key if array.include?(_type) end match end |