Class: Diagrams::Box
- Defined in:
- lib/maruku/ext/diagrams/structures.rb
Instance Attribute Summary collapse
-
#aligned ⇒ Object
Returns the value of attribute aligned.
-
#content ⇒ Object
Returns the value of attribute content.
-
#height ⇒ Object
Returns the value of attribute height.
-
#v_br ⇒ Object
variables for top-left and bottom-right.
-
#v_tl ⇒ Object
variables for top-left and bottom-right.
-
#width ⇒ Object
Returns the value of attribute width.
-
#x ⇒ Object
Returns the value of attribute x.
-
#y ⇒ Object
Returns the value of attribute y.
Attributes inherited from Sized
Instance Method Summary collapse
-
#initialize(x, y, width, height) ⇒ Box
constructor
A new instance of Box.
-
#link_direction(pos, inc) ⇒ Object
pos: position touching this from: other.
Constructor Details
#initialize(x, y, width, height) ⇒ Box
Returns a new instance of Box.
96 97 98 99 100 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 96 def initialize(x,y,width,height) super() @x,@y,@width,@height = x,y,width,height @aligned = {:l=>[],:t=>[],:b=>[],:r=>[]} end |
Instance Attribute Details
#aligned ⇒ Object
Returns the value of attribute aligned.
90 91 92 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 90 def aligned @aligned end |
#content ⇒ Object
Returns the value of attribute content.
88 89 90 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 88 def content @content end |
#height ⇒ Object
Returns the value of attribute height.
87 88 89 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 87 def height @height end |
#v_br ⇒ Object
variables for top-left and bottom-right
93 94 95 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 93 def v_br @v_br end |
#v_tl ⇒ Object
variables for top-left and bottom-right
93 94 95 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 93 def v_tl @v_tl end |
#width ⇒ Object
Returns the value of attribute width.
87 88 89 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 87 def width @width end |
#x ⇒ Object
Returns the value of attribute x.
87 88 89 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 87 def x @x end |
#y ⇒ Object
Returns the value of attribute y.
87 88 89 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 87 def y @y end |
Instance Method Details
#link_direction(pos, inc) ⇒ Object
pos: position touching this from: other
104 105 106 107 108 109 110 |
# File 'lib/maruku/ext/diagrams/structures.rb', line 104 def link_direction(pos, inc) if pos.x == @x then return :W end if pos.x == @x+@width-1 then return :E end if pos.y == @y then return :N end if pos.y == @y+@height-1 then return :S end raise "Strange #{pos.inspect}: "+self.inspect end |