Module: Cura::Attributes::HasOrientation
- Includes:
- HasAttributes
- Included in:
- Component::Pack, Component::Scrollbar
- Defined in:
- lib/cura/attributes/has_orientation.rb
Overview
Adds the ‘orientation` attribute to objects, which can be :vertical or :horizontal.
Instance Attribute Summary collapse
-
#orientation ⇒ Symbol
Get the orientation of this object.
Instance Method Summary collapse
-
#horizontal? ⇒ Boolean
Check if this object’s orientation is set to :horizontal.
- #initialize(attributes = {}) ⇒ Object
-
#vertical? ⇒ Boolean
Check if this object’s orientation is set to :vertical.
Methods included from HasAttributes
Instance Attribute Details
#orientation ⇒ Symbol
Get the orientation of this object.
18 19 20 |
# File 'lib/cura/attributes/has_orientation.rb', line 18 def orientation @orientation end |
Instance Method Details
#horizontal? ⇒ Boolean
Check if this object’s orientation is set to :horizontal.
35 36 37 |
# File 'lib/cura/attributes/has_orientation.rb', line 35 def horizontal? orientation == :horizontal end |
#initialize(attributes = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/cura/attributes/has_orientation.rb', line 9 def initialize(attributes={}) @orientation = :vertical unless instance_variable_defined?(:@orientation) super end |
#vertical? ⇒ Boolean
Check if this object’s orientation is set to :vertical.
42 43 44 |
# File 'lib/cura/attributes/has_orientation.rb', line 42 def vertical? orientation == :vertical end |