Sha256: 454de908812078650079e7eb9dcc53a03674afbcd8a75086d74b9a44de4926d3

Contents?: true

Size: 1.28 KB

Versions: 2

Compression:

Stored size: 1.28 KB

Contents

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

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

      # @!attribute options
      #   Open-ended Hash of component options, serialized via YAML to a single column.
      #   @return [Hash]
      serialize :options, Hash

      # @!attribute shard
      #   The {Shard} in which this {Component} is to run.
      #   @return [Shard]
      belongs_to :shard, :primary_key => 'uuid', :foreign_key => 'shard_uuid'

      # @!attribute input_ports
      #   The {InputPort}s of this component.
      #   @return [Array<InputPort>]
      has_many :input_ports,  :primary_key => 'uuid', :foreign_key => 'component_uuid'

      # @!attribute output_ports
      #   The {OutputPort}s of this component.
      #   @return [Array<OutputPort>]
      has_many :output_ports, :primary_key => 'uuid', :foreign_key => 'component_uuid'

      #TODO: Get this to work
      #has_many :input_connections, :through => :input_ports, :source => :input_connections
      #has_many :output_connections, :through => :output_ports, :source => :output_connection

      validates_uniqueness_of :name
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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