Sha256: 31937f84dd4927ec2830f69e6fde0d27093a601584a4a594300757b6a043a6ff

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

require 'active_record'
require 'rflow/configuration/uuid_keyed'

class RFlow
  class Configuration
    class Port < ConfigDB
      include UUIDKeyed
      include ActiveModel::Validations

      class PortInvalid < StandardError; end

      belongs_to :component,  :primary_key => 'uuid', :foreign_key => 'component_uuid'

      # TODO: Make some sort of component/port validation work here
      #validate :component_has_defined_port
    end

    # STI-based classes
    class InputPort < Port;
      has_many :input_connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'input_port_uuid'
      has_many :connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'input_port_uuid'
    end

    class OutputPort < Port;
      has_many :output_connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'output_port_uuid'
      has_many :connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'output_port_uuid'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rflow-1.0.0a1 lib/rflow/configuration/port.rb