Class: Draught::Container
- Inherits:
-
Object
- Object
- Draught::Container
show all
- Extended by:
- Forwardable
- Includes:
- Boxlike
- Defined in:
- lib/draught/container.rb
Constant Summary
Constants included
from Boxlike
Boxlike::POSITION_METHODS
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Boxlike
#bottom_edge, #centre, #centre_left, #centre_right, #containers, #corners, #disjoint?, #height, #include_point?, #left_edge, #lower_centre, #lower_left, #lower_right, #move_to, #overlaps?, #right_edge, #top_edge, #upper_centre, #upper_left, #upper_right, #width
Constructor Details
#initialize(box, opts = {}) ⇒ Container
Returns a new instance of Container.
13
14
15
16
|
# File 'lib/draught/container.rb', line 13
def initialize(box, opts = {})
@box = box
@min_gap = opts.fetch(:min_gap, 0)
end
|
Instance Attribute Details
#box ⇒ Object
Returns the value of attribute box.
9
10
11
|
# File 'lib/draught/container.rb', line 9
def box
@box
end
|
#min_gap ⇒ Object
Returns the value of attribute min_gap.
9
10
11
|
# File 'lib/draught/container.rb', line 9
def min_gap
@min_gap
end
|
Instance Method Details
#==(other) ⇒ Object
27
28
29
|
# File 'lib/draught/container.rb', line 27
def ==(other)
min_gap == other.min_gap && box == other.box
end
|
#box_type ⇒ Object
31
32
33
|
# File 'lib/draught/container.rb', line 31
def box_type
[:container]
end
|
#paths ⇒ Object
35
36
37
|
# File 'lib/draught/container.rb', line 35
def paths
[box]
end
|
22
23
24
25
|
# File 'lib/draught/container.rb', line 22
def transform(transformer)
transformed_min_gap = Point.new(min_gap,0).transform(transformer).x
self.class.new(box.transform(transformer), {min_gap: transformed_min_gap})
end
|
#translate(point) ⇒ Object
18
19
20
|
# File 'lib/draught/container.rb', line 18
def translate(point)
self.class.new(box.translate(point), {min_gap: min_gap})
end
|