Sha256: 4bb450a609c48064551ee2c8f16baee74ff09d4b5e8c711c97444200999c5828
Contents?: true
Size: 618 Bytes
Versions: 1
Compression:
Stored size: 618 Bytes
Contents
class LiquidValidator::Validator attr_reader :errors, :template, :error_mode def initialize(template, error_mode: :strict) @template = template @error_mode = error_mode @errors = [] @valid = true run_validations_on_template end def valid? @valid end private def run_validations_on_template if Gem.loaded_specs['liquid'].version.release >= Gem::Version.create('3') ::Liquid::Template.parse(template, error_mode: :strict) else ::Liquid::Template.parse(template) end rescue Liquid::SyntaxError => e @valid = false @errors << e.message end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
liquid-validator-1.0.1 | lib/liquid-validator/validator.rb |