Sha256: 4329dc08c1b0349b90933b27b96bdf5e7cd77288eaebd2c4aa4f8adba11570ba

Contents?: true

Size: 1.26 KB

Versions: 14

Compression:

Stored size: 1.26 KB

Contents

# -*- coding: utf-8 -*-

module DataMapper
  module Validations
    module Fixtures

      class UDPPacket
        #
        # Behaviors
        #

        include DataMapper::Resource

        #
        # Properties
        #

        property :id,          Serial

        property :source_port,      Integer, :auto_validation => false
        property :destination_port, Integer, :auto_validation => false

        property :length,           Integer, :auto_validation => false
        property :checksum,         String,  :auto_validation => false
        # consider that there are multiple algorithms
        # available to the app, and it is allowed
        # to be chosed
        #
        # yes, to some degree, this is a made up
        # property ;)
        property :checksum_algorithm, String, :auto_validation => false
        property :data,               Text,   :auto_validation => false

        #
        # Volatile attributes
        #

        attr_accessor :underlying_ip_version

        #
        # Validations
        #

        validates_presence_of :checksum_algorithm, :checksum, :if => Proc.new { |packet| packet.underlying_ip_version == 6 }, :message => "Checksum is mandatory when used with IPv6"
      end

    end # Fixtures
  end # Validations
end # DataMapper

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
ardm-validations-1.2.0 spec/fixtures/udp_packet.rb
dm-validations-1.2.0 spec/fixtures/udp_packet.rb
dm-validations-1.2.0.rc2 spec/fixtures/udp_packet.rb
dm-validations-1.2.0.rc1 spec/fixtures/udp_packet.rb
dm-validations-1.1.0 spec/fixtures/udp_packet.rb
dm-validations-1.1.0.rc3 spec/fixtures/udp_packet.rb
dm-validations-1.1.0.rc2 spec/fixtures/udp_packet.rb
dm-validations-1.1.0.rc1 spec/fixtures/udp_packet.rb
dm-validations-1.0.2 spec/fixtures/udp_packet.rb
dm-validations-1.0.1 spec/fixtures/udp_packet.rb
dm-validations-1.0.0 spec/fixtures/udp_packet.rb
dm-validations-1.0.0.rc3 spec/fixtures/udp_packet.rb
dm-validations-1.0.0.rc2 spec/fixtures/udp_packet.rb
dm-validations-1.0.0.rc1 spec/fixtures/udp_packet.rb