Class: Technologist::YamlParser
- Inherits:
-
Object
- Object
- Technologist::YamlParser
- Defined in:
- lib/technologist/yaml_parser.rb
Instance Attribute Summary collapse
-
#file_name ⇒ Object
readonly
Returns the value of attribute file_name.
Instance Method Summary collapse
-
#initialize(file_name) ⇒ YamlParser
constructor
A new instance of YamlParser.
- #rules ⇒ Object
Constructor Details
#initialize(file_name) ⇒ YamlParser
Returns a new instance of YamlParser.
7 8 9 |
# File 'lib/technologist/yaml_parser.rb', line 7 def initialize(file_name) @file_name = file_name end |
Instance Attribute Details
#file_name ⇒ Object (readonly)
Returns the value of attribute file_name.
5 6 7 |
# File 'lib/technologist/yaml_parser.rb', line 5 def file_name @file_name end |
Instance Method Details
#rules ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/technologist/yaml_parser.rb', line 11 def rules @rules ||= begin parsed_rules = from_file.map do |technology, definition| definition['rules'].map! do |rule| instancify(technology, rule) end [technology, definition] end Hash[parsed_rules] end end |