Module: Cura::Attributes::HasOffsets

Includes:
HasAttributes
Included in:
Component::Base
Defined in:
lib/cura/attributes/has_offsets.rb

Overview

Adds the ‘offsets` attribute to objects.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HasAttributes

included, #update_attributes

Instance Attribute Details

#offsetsOffsets (readonly)

Get the offsets of this object.



67
68
69
# File 'lib/cura/attributes/has_offsets.rb', line 67

def offsets
  @offsets
end

Instance Method Details

#borderBorders

Get the borders of this object.



# File 'lib/cura/attributes/has_offsets.rb', line 15


#border=(value) ⇒ Borders

Set the borders of this object.



26
# File 'lib/cura/attributes/has_offsets.rb', line 26

attribute(:border, type: Borders) { |value, options| validate_offset_attribute(value, options[:type]) }

#initialize(attributes = {}) ⇒ Object



54
55
56
57
58
59
60
61
62
# File 'lib/cura/attributes/has_offsets.rb', line 54

def initialize(attributes={})
  @offsets = Offsets.new(component: self)

  self.margin  = attributes[:margin]
  self.border  = attributes[:border]
  self.padding = attributes[:padding]

  super
end

#marginMargins

Get the margins of this object.



# File 'lib/cura/attributes/has_offsets.rb', line 28


#margin=(value) ⇒ Margins

Set the margins of this object.



39
# File 'lib/cura/attributes/has_offsets.rb', line 39

attribute(:margin, type: Margins) { |value, options| validate_offset_attribute(value, options[:type]) }

#paddingPadding

Get the padding of this object.



# File 'lib/cura/attributes/has_offsets.rb', line 41


#padding=(value) ⇒ Padding

Set the padding of this object.



52
# File 'lib/cura/attributes/has_offsets.rb', line 52

attribute(:padding, type: Padding) { |value, options| validate_offset_attribute(value, options[:type]) }