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)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


46
47
48
# File 'lib/cura/attributes/has_orientation.rb', line 46

def vertical?
  orientation == :vertical
end