Class: MonoclePrint::Pair

Inherits:
Struct
  • Object
show all
Defined in:
lib/monocle-print/geometry.rb,
lib/monocle-print/geometry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(x = 0, y = 0) ⇒ Pair

Returns a new instance of Pair.



20
21
22
# File 'lib/monocle-print/geometry.rb', line 20

def initialize( x = 0, y = 0 )
  super
end

Instance Attribute Details

#xObject

Returns the value of attribute x

Returns:

  • (Object)

    the current value of x



5
6
7
# File 'lib/monocle-print/geometry.rb', line 5

def x
  @x
end

#yObject

Returns the value of attribute y

Returns:

  • (Object)

    the current value of y



5
6
7
# File 'lib/monocle-print/geometry.rb', line 5

def y
  @y
end

Instance Method Details

#+(n) ⇒ Object



41
42
43
44
# File 'lib/monocle-print/geometry.rb', line 41

def +( n )
  self.column += n
  self
end

#+@Object



24
25
26
27
28
# File 'lib/monocle-print/geometry.rb', line 24

def +@
  self.column = 0
  self.line += 1
  self
end

#-(n) ⇒ Object



46
47
48
49
# File 'lib/monocle-print/geometry.rb', line 46

def -( n )
  self.column -= n
  self
end

#-@Object



35
36
37
38
39
# File 'lib/monocle-print/geometry.rb', line 35

def -@
  self.column = 0
  self.line -= 1
  self
end

#~Object



30
31
32
33
# File 'lib/monocle-print/geometry.rb', line 30

def ~
  self.column = 0
  self
end