Skip to content

Commit

Permalink
Make caching the parsing easier
Browse files Browse the repository at this point in the history
  • Loading branch information
byroot committed Sep 16, 2020
1 parent b744991 commit a9f7dda
Show file tree
Hide file tree
Showing 7 changed files with 171 additions and 123 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ ERR
end

assert_dependency_version("Ragel", "7.0.0.9", "ragel -v")
assert_dependency_version("Racc", "1.4.15", %|ruby -e "require 'racc'; puts Racc::VERSION"|)
assert_dependency_version("Racc", "1.4.16", %|ruby -e "require 'racc'; puts Racc::VERSION"|)

`rm -f lib/graphql/language/parser.rb lib/graphql/language/lexer.rb `
`racc lib/graphql/language/parser.y -o lib/graphql/language/parser.rb`
Expand Down
8 changes: 8 additions & 0 deletions lib/graphql.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ class Error < StandardError
class RequiredImplementationMissingError < Error
end

class << self
def default_parser
@default_parser ||= GraphQL::Language::Parser
end

attr_writer :default_parser
end

# Turn a query string or schema definition into an AST
# @param graphql_string [String] a GraphQL query string or schema definition
# @return [GraphQL::Language::Nodes::Document]
Expand Down
Loading

0 comments on commit a9f7dda

Please sign in to comment.