Sha256: 8f03e9aac07608c679f697536cfeba92fa574488a0736fa86d1ad6ceb1ed74c5

Contents?: true

Size: 571 Bytes

Versions: 2

Compression:

Stored size: 571 Bytes

Contents

require 'schematic/generator/restrictions/base'

module Schematic
  module Generator
    module Restrictions
      class Custom < Base
        def generate(builder)
          validators_for_column.each do |validator|
            if validator.respond_to?(:xsd_pattern_restrictions)
              validator.xsd_pattern_restrictions.each do |restriction|
                builder.xs(:pattern, 'value' => restriction.is_a?(Regexp) ? restriction.source : restriction)
              end
              return
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
schematic-0.7.1 lib/schematic/generator/restrictions/custom.rb
schematic-0.7.0 lib/schematic/generator/restrictions/custom.rb