Class: Rabbit::Size
- Inherits:
-
Object
- Object
- Rabbit::Size
- Defined in:
- lib/rabbit/size.rb
Instance Attribute Summary collapse
-
#base_height ⇒ Object
readonly
Returns the value of attribute base_height.
-
#base_width ⇒ Object
readonly
Returns the value of attribute base_width.
-
#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_content_height ⇒ Object
readonly
Returns the value of attribute real_content_height.
-
#real_content_width ⇒ Object
readonly
Returns the value of attribute real_content_width.
-
#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(base_width, base_height, width, height, ratio) ⇒ Size
constructor
A new instance of Size.
- #logical_scale ⇒ Object
Constructor Details
#initialize(base_width, base_height, width, height, ratio) ⇒ Size
Returns a new instance of Size.
32 33 34 35 36 37 38 39 |
# File 'lib/rabbit/size.rb', line 32 def initialize(base_width, base_height, width, height, ratio) @base_width = base_width @base_height = base_height @real_width = width @real_height = height @ratio = ratio compute_logical_size end |
Instance Attribute Details
#base_height ⇒ Object (readonly)
Returns the value of attribute base_height.
20 21 22 |
# File 'lib/rabbit/size.rb', line 20 def base_height @base_height end |
#base_width ⇒ Object (readonly)
Returns the value of attribute base_width.
19 20 21 |
# File 'lib/rabbit/size.rb', line 19 def base_width @base_width end |
#logical_height ⇒ Object (readonly)
Returns the value of attribute logical_height.
26 27 28 |
# File 'lib/rabbit/size.rb', line 26 def logical_height @logical_height end |
#logical_margin_bottom ⇒ Object (readonly)
Returns the value of attribute logical_margin_bottom.
30 31 32 |
# File 'lib/rabbit/size.rb', line 30 def logical_margin_bottom @logical_margin_bottom end |
#logical_margin_left ⇒ Object (readonly)
Returns the value of attribute logical_margin_left.
27 28 29 |
# File 'lib/rabbit/size.rb', line 27 def logical_margin_left @logical_margin_left end |
#logical_margin_right ⇒ Object (readonly)
Returns the value of attribute logical_margin_right.
28 29 30 |
# File 'lib/rabbit/size.rb', line 28 def logical_margin_right @logical_margin_right end |
#logical_margin_top ⇒ Object (readonly)
Returns the value of attribute logical_margin_top.
29 30 31 |
# File 'lib/rabbit/size.rb', line 29 def logical_margin_top @logical_margin_top end |
#logical_width ⇒ Object (readonly)
Returns the value of attribute logical_width.
25 26 27 |
# File 'lib/rabbit/size.rb', line 25 def logical_width @logical_width end |
#ratio ⇒ Object (readonly)
Returns the value of attribute ratio.
31 32 33 |
# File 'lib/rabbit/size.rb', line 31 def ratio @ratio end |
#real_content_height ⇒ Object (readonly)
Returns the value of attribute real_content_height.
24 25 26 |
# File 'lib/rabbit/size.rb', line 24 def real_content_height @real_content_height end |
#real_content_width ⇒ Object (readonly)
Returns the value of attribute real_content_width.
23 24 25 |
# File 'lib/rabbit/size.rb', line 23 def real_content_width @real_content_width end |
#real_height ⇒ Object (readonly)
Returns the value of attribute real_height.
22 23 24 |
# File 'lib/rabbit/size.rb', line 22 def real_height @real_height end |
#real_width ⇒ Object (readonly)
Returns the value of attribute real_width.
21 22 23 |
# File 'lib/rabbit/size.rb', line 21 def real_width @real_width end |
Instance Method Details
#have_logical_margin? ⇒ Boolean
51 52 53 |
# File 'lib/rabbit/size.rb', line 51 def have_logical_margin? have_logical_margin_x? or have_logical_margin_y? end |
#have_logical_margin_x? ⇒ Boolean
41 42 43 44 |
# File 'lib/rabbit/size.rb', line 41 def have_logical_margin_x? @logical_margin_left > 0 or @logical_margin_right > 0 end |
#have_logical_margin_y? ⇒ Boolean
46 47 48 49 |
# File 'lib/rabbit/size.rb', line 46 def have_logical_margin_y? @logical_margin_top > 0 or @logical_margin_bottom > 0 end |
#logical_scale ⇒ Object
55 56 57 |
# File 'lib/rabbit/size.rb', line 55 def logical_scale @logical_scale end |