module Cura::Attributes::HasOffsets
Adds the `offsets` attribute to objects.
Attributes
offsets[R]
Get the offsets of this object.
@return [Offsets]
Public Class Methods
new(attributes={})
click to toggle source
Calls superclass method
Cura::Attributes::HasAttributes::new
# 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
Protected Instance Methods
validate_offset_attribute(value, type)
click to toggle source
# File lib/cura/attributes/has_offsets.rb, line 71 def validate_offset_attribute(value, type) value ||= {} value.is_a?(type) ? value : type.new(value) end