Module: Reality::Git::AttributesParser
- Defined in:
- lib/reality/git/attributes_parser.rb
Overview
Parse the Git attribute file extracting the attributes for file patterns.
Class Method Summary collapse
-
.parse_file(filename) ⇒ Object
Parses the specified Git attributes file.
Class Method Details
.parse_file(filename) ⇒ Object
Parses the specified Git attributes file.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/reality/git/attributes_parser.rb', line 32 def parse_file(filename) rules = [] comment = '#' IO.readlines(filename).each do |line| next if line.start_with?(comment) || line.empty? pattern, attrs = line.split(/\s+/, 2) parsed_attributes = attrs ? parse_attributes(attrs) : {} rules << AttributeRule.new(pattern, parsed_attributes) end # Newer entries take precedence over older entries. rules end |