File: erubis_enhancer.rb

package info (click to toggle)
ruby-graphql-client 0.18.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 252 kB
  • sloc: ruby: 1,878; makefile: 4
file content (22 lines) | stat: -rw-r--r-- 514 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module GraphQL
  class Client
    # Public: Erubis enhancer that adds support for GraphQL static query sections.
    #
    #   <%graphql
    #     query GetVersion {
    #       version
    #     }
    #   %>
    #   <%= data.version %>
    #
    module ErubisEnhancer
      # Internal: Extend Erubis handler to simply ignore <%graphql sections.
      def convert_input(src, input)
        input = input.gsub(/<%graphql/, "<%#")
        super(src, input)
      end
    end
  end
end