Sha256: 0e888032b669a9b5f334c84fc21a2b079eb567f7017fc82da208f4bafb2fa038

Contents?: true

Size: 506 Bytes

Versions: 1

Compression:

Stored size: 506 Bytes

Contents

module Rocx
  module Properties
    class Language < ComplexProperty
      include AttributeBuilder

      tag :lang
      attribute :bidi, expects: :valid_language
      attribute :east_asia, expects: :valid_language
      attribute :latin, expects: :valid_language, displays_as: :val

    private

      def valid_language(value)
        message = "Invalid #{name}: must be a language code (RFC 4646)"
        raise ArgumentError, message unless value =~ /[a-z]{2}-[A-Z]{2}/
      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rocx-0.5.8 lib/rocx/properties/language.rb