Class: Technologist::FrameworkDetector
- Inherits:
-
Object
- Object
- Technologist::FrameworkDetector
- Defined in:
- lib/technologist/framework_detector.rb
Constant Summary collapse
- FRAMEWORK_RULES =
File.('../frameworks.yml', __FILE__)
Instance Attribute Summary collapse
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
-
#yaml_parser ⇒ Object
readonly
Returns the value of attribute yaml_parser.
Instance Method Summary collapse
- #frameworks ⇒ Object
-
#initialize(repository) ⇒ FrameworkDetector
constructor
A new instance of FrameworkDetector.
- #primary_frameworks ⇒ Object
- #secondary_frameworks ⇒ Object
Constructor Details
#initialize(repository) ⇒ FrameworkDetector
Returns a new instance of FrameworkDetector.
9 10 11 12 |
# File 'lib/technologist/framework_detector.rb', line 9 def initialize(repository) @repository = repository @yaml_parser = YamlParser.new(FRAMEWORK_RULES) end |
Instance Attribute Details
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
7 8 9 |
# File 'lib/technologist/framework_detector.rb', line 7 def repository @repository end |
#yaml_parser ⇒ Object (readonly)
Returns the value of attribute yaml_parser.
7 8 9 |
# File 'lib/technologist/framework_detector.rb', line 7 def yaml_parser @yaml_parser end |
Instance Method Details
#frameworks ⇒ Object
14 15 16 17 18 |
# File 'lib/technologist/framework_detector.rb', line 14 def frameworks matched_frameworks.flat_map do |technology, definition| [definition['primary'], technology] end.compact.uniq end |
#primary_frameworks ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/technologist/framework_detector.rb', line 20 def primary_frameworks matched_frameworks.map do |technology, definition| # it's either the primary value defined in the yaml # or the technology itself definition['primary'] || technology end.uniq end |
#secondary_frameworks ⇒ Object
28 29 30 31 32 33 |
# File 'lib/technologist/framework_detector.rb', line 28 def secondary_frameworks matched_frameworks.map do |technology, definition| # it's a secondary if a primary is defined in the yaml definition['primary'] && technology end.compact end |