Module: Cura::Attributes::HasDimensions
- Includes:
- HasAttributes
- Included in:
- Component::Base, Event::Resize, Window
- Defined in:
- lib/cura/attributes/has_dimensions.rb
Overview
Adds the ‘width` and `height` attributes.
Instance Method Summary collapse
-
#height ⇒ Integer
Get the height dimension of this object.
-
#height=(value) ⇒ Integer
Set the height dimension of this object.
- #initialize(attributes = {}) ⇒ Object
-
#resize(options) ⇒ Object
Set one or both of the dimensions of this object.
-
#width ⇒ Integer
Get the width dimension of this object.
-
#width=(value) ⇒ Integer
Set the width dimension of this object.
Methods included from HasAttributes
Instance Method Details
#height ⇒ Integer
Get the height dimension of this object.
|
# File 'lib/cura/attributes/has_dimensions.rb', line 29
|
#height=(value) ⇒ Integer
Set the height dimension of this object.
40 |
# File 'lib/cura/attributes/has_dimensions.rb', line 40 attribute(:height) { |value| validate_size_attribute(value) } |
#initialize(attributes = {}) ⇒ Object
9 10 11 12 13 14 |
# 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 |
#resize(options) ⇒ Object
Set one or both of the dimensions of this object.
47 48 49 50 51 52 53 54 |
# File 'lib/cura/attributes/has_dimensions.rb', line 47 def resize() = .to_h self.width = [:width] if .key?(:width) self.height = [:height] if .key?(:height) self end |
#width ⇒ Integer
Get the width dimension of this object.
|
# File 'lib/cura/attributes/has_dimensions.rb', line 16
|
#width=(value) ⇒ Integer
Set the width dimension of this object.
27 |
# File 'lib/cura/attributes/has_dimensions.rb', line 27 attribute(:width) { |value| validate_size_attribute(value) } |