Class: Rabbit::Size
- Inherits:
-
Object
- Object
- Rabbit::Size
- Defined in:
- lib/rabbit/size.rb
Instance Attribute Summary collapse
-
#logical_height ⇒ Object
readonly
Returns the value of attribute logical_height.
-
#logical_margin_bottom ⇒ Object
readonly
Returns the value of attribute logical_margin_bottom.
-
#logical_margin_left ⇒ Object
readonly
Returns the value of attribute logical_margin_left.
-
#logical_margin_right ⇒ Object
readonly
Returns the value of attribute logical_margin_right.
-
#logical_margin_top ⇒ Object
readonly
Returns the value of attribute logical_margin_top.
-
#logical_width ⇒ Object
readonly
Returns the value of attribute logical_width.
-
#ratio ⇒ Object
readonly
Returns the value of attribute ratio.
-
#real_height ⇒ Object
readonly
Returns the value of attribute real_height.
-
#real_width ⇒ Object
readonly
Returns the value of attribute real_width.
Instance Method Summary collapse
- #have_logical_margin? ⇒ Boolean
- #have_logical_margin_x? ⇒ Boolean
- #have_logical_margin_y? ⇒ Boolean
-
#initialize(width, height, ratio) ⇒ Size
constructor
A new instance of Size.
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_height ⇒ Object (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_bottom ⇒ Object (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_left ⇒ Object (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_right ⇒ Object (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_top ⇒ Object (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_width ⇒ Object (readonly)
Returns the value of attribute logical_width.
5 6 7 |
# File 'lib/rabbit/size.rb', line 5 def logical_width @logical_width end |
#ratio ⇒ Object (readonly)
Returns the value of attribute ratio.
11 12 13 |
# File 'lib/rabbit/size.rb', line 11 def ratio @ratio end |
#real_height ⇒ Object (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_width ⇒ Object (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
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
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
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 |