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

Instance Method Summary collapse

Methods included from HasAttributes

included, #update_attributes

Instance Attribute Details

#orientationSymbol

Get the orientation of this object.

Returns:

  • (Symbol)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


42
43
44
# File 'lib/cura/attributes/has_orientation.rb', line 42

def vertical?
  orientation == :vertical
end