Class: BinderCore::Scanner
- Inherits:
-
Object
- Object
- BinderCore::Scanner
- Defined in:
- lib/binder_core/scanner.rb
Class Method Summary collapse
-
.descend(config) ⇒ Object
Parse all files in a directory.
-
.scan(config) ⇒ Object
Parse a file obtaining a parser from the configured definitions.
Class Method Details
.descend(config) ⇒ Object
Parse all files in a directory
19 20 21 22 23 24 |
# File 'lib/binder_core/scanner.rb', line 19 def self.descend(config) context = FolderContext.new config.call Config.new context context.console.stack.add_folder context.route, context context.parse_files end |
.scan(config) ⇒ Object
Parse a file obtaining a parser from the configured definitions. Returns a parsed file context
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/binder_core/scanner.rb', line 5 def self.scan(config) # configure the context context = FileContext.new config.call Config.new context context.console.stack.add_file context.route, context # parse the file file_parser = get_parser_for context context.console.stack.add_parser context.route, file_parser file_parser.parse # return parsed context context end |