module Cura::Attributes::HasOrientation
Adds the `orientation` attribute to objects, which can be :vertical or :horizontal.
Attributes
orientation[R]
Get the orientation of this object.
@return [Symbol]
Public Class Methods
new(attributes={})
click to toggle source
Calls superclass method
Cura::Attributes::HasAttributes::new
# File lib/cura/attributes/has_orientation.rb, line 9 def initialize(attributes={}) @orientation = :vertical unless instance_variable_defined?(:@orientation) super end
Public Instance Methods
horizontal?()
click to toggle source
Check if this object's orientation is set to :horizontal.
@return [Boolean]
# File lib/cura/attributes/has_orientation.rb, line 35 def horizontal? orientation == :horizontal end
orientation=(value)
click to toggle source
Set the orientation of this object. Must be :vertical or :horizontal.
@param [#to_sym] value @return [Symbol]
# File lib/cura/attributes/has_orientation.rb, line 25 def orientation=(value) value = value.to_sym raise ArgumentError, "orientation must be one of :vertical or :horizontal" unless [:vertical, :horizontal].include?(value) @orientation = value end
vertical?()
click to toggle source
Check if this object's orientation is set to :vertical.
@return [Boolean]
# File lib/cura/attributes/has_orientation.rb, line 42 def vertical? orientation == :vertical end