module Cura::Attributes::HasDimensions

Adds the `width` and `height` attributes.

Public Class Methods

new(attributes={}) click to toggle source
Calls superclass method Cura::Attributes::HasAttributes::new
# File lib/cura/attributes/has_dimensions.rb, line 9
def initialize(attributes={})
  @width = :auto unless instance_variable_defined?(:@width)
  @height = :auto unless instance_variable_defined?(:@height)

  super
end

Public Instance Methods

resize(options) click to toggle source

Set one or both of the dimensions of this object. @param [#to_h] options @option options [#to_i] :width @option options [#to_i] :height @return [Object] This object

# File lib/cura/attributes/has_dimensions.rb, line 47
def resize(options)
  options = options.to_h

  self.width = options[:width] if options.key?(:width)
  self.height = options[:height] if options.key?(:height)

  self
end