syntax_tree 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SyntaxTree
4
- VERSION = "2.0.0"
4
+ VERSION = "2.0.1"
5
5
  end
data/lib/syntax_tree.rb CHANGED
@@ -25,6 +25,17 @@ unless PrettyPrint.const_defined?(:Align)
25
25
  end
26
26
 
27
27
  module SyntaxTree
28
+ # This holds references to objects that respond to both #parse and #format
29
+ # so that we can use them in the CLI.
30
+ HANDLERS = {}
31
+ HANDLERS.default = SyntaxTree
32
+
33
+ # This is a hook provided so that plugins can register themselves as the
34
+ # handler for a particular file type.
35
+ def self.register_handler(extension, handler)
36
+ HANDLERS[extension] = handler
37
+ end
38
+
28
39
  # Parses the given source and returns the syntax tree.
29
40
  def self.parse(source)
30
41
  parser = Parser.new(source)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syntax_tree
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Newton
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.3.3
124
+ rubygems_version: 3.4.0.dev
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: A parser based on ripper