Sha256: 17faa5f83d2a706392fee54c2653783b16780e799788a479df71009d1aa90ff2

Contents?: true

Size: 615 Bytes

Versions: 2

Compression:

Stored size: 615 Bytes

Contents

require 'hashmake'

module SPNet
class InPort
  
  include Hashmake::HashMakeable
    
  ARG_SPECS = [
    Hashmake::ArgSpec.new(:reqd => false, :key => :name, :type => String, :default => "UNNAMED"),
    Hashmake::ArgSpec.new(:reqd => true, :key => :matching_port_class, :type => Class),
  ]

  attr_reader :name, :link
  
  def initialize args
    hash_make InPort::ARG_SPECS, args
    @link = nil
  end
  
  def clear_link
    @link = nil
  end
  
  def set_link link
    raise ArgumentError, "link #{link} is not a #{@matching_port_class}" unless link.is_a?(@matching_port_class)
    @link = link
  end
end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spnet-0.1.4 lib/spnet/in_port.rb
spnet-0.1.3 lib/spnet/in_port.rb