File: validator.rb

package info (click to toggle)
ruby-temple 0.10.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 476 kB
  • sloc: ruby: 3,347; makefile: 6
file content (16 lines) | stat: -rw-r--r-- 318 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true
module Temple
  module Filters
    # Validates temple expression with given grammar
    #
    # @api public
    class Validator < Filter
      define_options grammar: Temple::Grammar

      def compile(exp)
        options[:grammar].validate!(exp)
        exp
      end
    end
  end
end