Class: Yzz::NegwardSide

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

Overview

Separate class for negward 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 NegwardSide is always :negward.



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

def direction; :negward end

#labelObject

Returns the “side label” string.



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

def label
  "<-#{dimension}"
end

#opposite_directionObject

Opposite direction of a NegwardSide is always :negward.



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

def opposite_direction; :posward end

#opposite_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, posward side opposite to the receiver is returned.



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

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

#same_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, the method simply returns the receiver.



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

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

#to_sObject

Returns the string briefly describing the instance.



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

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