Skip to content

Commit

Permalink
refactoried registered_natures and registered_formats
Browse files Browse the repository at this point in the history
  • Loading branch information
CostinTanasoiu committed Aug 24, 2023
1 parent 13ee6ab commit 4808bdb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/format_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ module FormatParser
# The value will ensure the parser having it will be applied to the file last.
LEAST_PRIORITY = 99

@registered_natures = []
@registered_formats = []

# Register a parser object to be used to perform file format detection. Each parser FormatParser
# provides out of the box registers itself using this method.
#
Expand Down Expand Up @@ -69,9 +72,7 @@ def self.register_parser(callable_parser, formats:, natures:, priority: LEAST_PR
@parser_priorities ||= {}
@parser_priorities[callable_parser] = priority

@registered_natures ||= []
@registered_natures |= parser_provided_natures
@registered_formats ||= []
@registered_formats |= parser_provided_formats
end
end
Expand Down

0 comments on commit 4808bdb

Please sign in to comment.