Sha256: 28c88fd6b98cf3baab966fdbf6f054f4b234932612343430185bd89d7ec615fa

Contents?: true

Size: 523 Bytes

Versions: 8

Compression:

Stored size: 523 Bytes

Contents

module Alf
  module Types
    #
    # Attribute name.
    #
    # Attribute names are ruby symbols that match the following regular expression:
    #
    #     /^[a-zA-Z0-9_]+[?!]?$/
    #
    # Example:
    #
    #     AttrName.coerce("city")
    #     # => :city
    #
    class AttrName < Symbol
      extend Domain::SByC.new(Symbol){|s| s.to_s =~ /^[a-zA-Z0-9_]+[?!]?$/}

      coercions do |c|
        c.delegate(:to_sym){|v,_| new(v.to_sym) }
      end

    end # class AttrName
  end # module Types
end # module Alf

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alf-core-0.16.3 lib/alf/types/attr_name.rb
alf-core-0.16.2 lib/alf/types/attr_name.rb
alf-core-0.16.1 lib/alf/types/attr_name.rb
alf-core-0.16.0 lib/alf/types/attr_name.rb
alf-core-0.15.0 lib/alf/types/attr_name.rb
alf-core-0.14.0 lib/alf-types/alf/types/attr_name.rb
alf-core-0.13.1 lib/alf-types/alf/types/attr_name.rb
alf-core-0.13.0 lib/alf-types/alf/types/attr_name.rb