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.
22 23 24 |
# File 'lib/cura/attributes/has_orientation.rb', line 22 def orientation @orientation end |
Instance Method Details
#horizontal? ⇒ Boolean
Check if this object’s orientation is set to :horizontal.
39 40 41 |
# File 'lib/cura/attributes/has_orientation.rb', line 39 def horizontal? orientation == :horizontal end |
#initialize(attributes = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/cura/attributes/has_orientation.rb', line 13 def initialize(attributes={}) @orientation = :vertical unless instance_variable_defined?(:@orientation) super end |
#vertical? ⇒ Boolean
Check if this object’s orientation is set to :vertical.
46 47 48 |
# File 'lib/cura/attributes/has_orientation.rb', line 46 def vertical? orientation == :vertical end |