Sha256: 29a3e3bfd25143874e1266022d0e8606bed3ee06cb707dc5a15ff5f323c3a495

Contents?: true

Size: 1.81 KB

Versions: 2

Compression:

Stored size: 1.81 KB

Contents

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

class RFlow
  class Configuration
    # Represents a component port in the SQLite database.
    class Port < ConfigurationItem
      include UUIDKeyed
      include ActiveModel::Validations

      # @!attribute component
      #   The {Component} to which this port belongs.
      #   @return [Component]
      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

    # Subclass of {Port} to represent input ports.
    class InputPort < Port
      # @!attribute input_connections
      #   The connections delivering messages to this {InputPort}.
      #   @return [Array<Connection>]
      has_many :input_connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'input_port_uuid'

      # @!attribute connections
      #   Synonym for {input_connections}.
      #   @return [Array<Connection>]
      has_many :connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'input_port_uuid'
    end

    # Subclass of {Port} to represent output ports.
    class OutputPort < Port
      # @!attribute output_connections
      #   The connections receiving messages from this {OutputPort}.
      #   @return [Array<Connection>]
      has_many :output_connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'output_port_uuid'

      # @!attribute connections
      #   Synonym for {output_connections}.
      #   @return [Array<Connection>]
      has_many :connections, :class_name => 'RFlow::Configuration::Connection', :primary_key => 'uuid', :foreign_key => 'output_port_uuid'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rflow-1.3.2 lib/rflow/configuration/port.rb
rflow-1.3.1 lib/rflow/configuration/port.rb