class SOCMaker::IfcPort
A small classes, used to group information and to verify, auto-correct and auto-complete this information: The class represents an interface port within SOCMaker::IfcDef
. It is used to make a relation between the naming of SOCMaker::IfcDef
and SOCMaker::IfcSpc
. The two data fiels are
Attributes
len[RW]
Length of this port
spc_ref[RW]
Used as reference to a port in SOCMaker::IfcSpc
Public Class Methods
Public Instance Methods
==(o)
click to toggle source
Equality operator
# File lib/soc_maker/ifc_port.rb, line 125 def ==(o) o.class == self.class && o.spc_ref == self.spc_ref && o.len == self.len end
encode_with( coder )
click to toggle source
Encoder method (to yaml)
coder
-
An instance of the Psych::Coder to encode this class to a YAML file
# File lib/soc_maker/ifc_port.rb, line 82 def encode_with( coder ) init_error_if !coder.is_a?( Psych::Coder ), 'coder is not given as Psych::Coder' %w[ spc_ref len ]. each { |v| coder[ v ] = instance_variable_get "@#{v}" } end
init_with( coder )
click to toggle source
Initialization method (from yaml)
coder
-
An instance of the Psych::Coder to init this class from a YAML file
# File lib/soc_maker/ifc_port.rb, line 96 def init_with( coder ) init_error_if !( coder.is_a?( Hash ) || coder.is_a?( Psych::Coder ) ), 'coder is not given as Hash neither as Psych::Coder' init_error 'no relation to interface-definition is given for an interface port (nil)', field: "spc_ref" if coder[ 'spc_ref' ] == nil @spc_ref = coder[ 'spc_ref' ] init_error 'Relation to interface definition is not of type string', instance: @spc_ref.to_s, field: "spc_ref" if !@spc_ref.is_a?( String ) init_error 'Relation to interface definition has zero length', instance: @spc_ref.to_s, field: "spc_ref" if @spc_ref.size == 0 @len = coder[ 'len' ] || 1 init_error 'Length is not a fixnum', instance: @spc_ref.to_s, field: "spc_ref" if !( @len.is_a?( Fixnum ) || @len.is_a?( String ) ) end