Class: Yzz::PoswardSide

Inherits:
Object show all
Includes:
Side
Defined in:
lib/yzz/posward_side.rb

Overview

Separate class for posward sides of zz objects.

Instance Attribute Summary

Attributes included from Side

#neighbor

Instance Method Summary collapse

Methods included from Side

#crossover, #dimension, #initialize, #inspect, #link, #unlink, #zz

Instance Method Details

#directionObject

The direction of a PoswardSide is always :posward.



8
# File 'lib/yzz/posward_side.rb', line 8

def direction; :posward end

#labelObject

Returns the “side label” string.



32
33
34
# File 'lib/yzz/posward_side.rb', line 32

def label
  "#{dimension}->"
end

#opposite_directionObject

Opposite direction of a PoswardSide is always :negward.



12
# File 'lib/yzz/posward_side.rb', line 12

def opposite_direction; :posward end

#opposite_side(of: zz) ⇒ Object

Given a Yzz object, returns its negward side along the dimension same as the receiver’s dimension. If no object is given, negward side opposite to the receiver is returned.



26
27
28
# File 'lib/yzz/posward_side.rb', line 26

def opposite_side( of: zz )
  of.along( dimension ).negward
end

#same_side(of: zz) ⇒ Object

Given a Yzz object, returns its posward side along the dimension same as the receiver’s dimension. If no object is given, the method simply returns the receiver.



18
19
20
# File 'lib/yzz/posward_side.rb', line 18

def same_side( of: zz )
  of.along( dimension ).posward
end

#to_sObject

Returns the string briefly describing the instance.



38
39
40
# File 'lib/yzz/posward_side.rb', line 38

def to_s
  "#<Yzz::PoswardSide of #{zz} along #{dimension}>"
end