Class: Rabbit::Size

Inherits:
Object
  • Object
show all
Defined in:
lib/rabbit/size.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height, ratio) ⇒ Size

Returns a new instance of Size.



12
13
14
15
16
17
# File 'lib/rabbit/size.rb', line 12

def initialize(width, height, ratio)
  @real_width = width
  @real_height = height
  @ratio = ratio
  compute_logical_size
end

Instance Attribute Details

#logical_heightObject (readonly)

Returns the value of attribute logical_height.



6
7
8
# File 'lib/rabbit/size.rb', line 6

def logical_height
  @logical_height
end

#logical_margin_bottomObject (readonly)

Returns the value of attribute logical_margin_bottom.



10
11
12
# File 'lib/rabbit/size.rb', line 10

def logical_margin_bottom
  @logical_margin_bottom
end

#logical_margin_leftObject (readonly)

Returns the value of attribute logical_margin_left.



7
8
9
# File 'lib/rabbit/size.rb', line 7

def logical_margin_left
  @logical_margin_left
end

#logical_margin_rightObject (readonly)

Returns the value of attribute logical_margin_right.



8
9
10
# File 'lib/rabbit/size.rb', line 8

def logical_margin_right
  @logical_margin_right
end

#logical_margin_topObject (readonly)

Returns the value of attribute logical_margin_top.



9
10
11
# File 'lib/rabbit/size.rb', line 9

def logical_margin_top
  @logical_margin_top
end

#logical_widthObject (readonly)

Returns the value of attribute logical_width.



5
6
7
# File 'lib/rabbit/size.rb', line 5

def logical_width
  @logical_width
end

#ratioObject (readonly)

Returns the value of attribute ratio.



11
12
13
# File 'lib/rabbit/size.rb', line 11

def ratio
  @ratio
end

#real_heightObject (readonly)

Returns the value of attribute real_height.



4
5
6
# File 'lib/rabbit/size.rb', line 4

def real_height
  @real_height
end

#real_widthObject (readonly)

Returns the value of attribute real_width.



3
4
5
# File 'lib/rabbit/size.rb', line 3

def real_width
  @real_width
end

Instance Method Details

#have_logical_margin?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/rabbit/size.rb', line 29

def have_logical_margin?
  have_logical_margin_x? or have_logical_margin_y?
end

#have_logical_margin_x?Boolean

Returns:

  • (Boolean)


19
20
21
22
# File 'lib/rabbit/size.rb', line 19

def have_logical_margin_x?
  @logical_margin_left > 0 or
    @logical_margin_right > 0
end

#have_logical_margin_y?Boolean

Returns:

  • (Boolean)


24
25
26
27
# File 'lib/rabbit/size.rb', line 24

def have_logical_margin_y?
  @logical_margin_top > 0 or
    @logical_margin_bottom > 0
end