Class: Hokusai::Padding
- Inherits:
-
Object
- Object
- Hokusai::Padding
- Defined in:
- ui/src/hokusai/types.rb
Instance Attribute Summary collapse
-
#bottom ⇒ Object
(also: #b)
readonly
Returns the value of attribute bottom.
-
#left ⇒ Object
(also: #l)
readonly
Returns the value of attribute left.
-
#right ⇒ Object
(also: #r)
readonly
Returns the value of attribute right.
-
#top ⇒ Object
(also: #t)
readonly
Returns the value of attribute top.
Class Method Summary collapse
Instance Method Summary collapse
- #hash ⇒ Object
-
#initialize(top, right, bottom, left) ⇒ Padding
constructor
A new instance of Padding.
Constructor Details
#initialize(top, right, bottom, left) ⇒ Padding
Returns a new instance of Padding.
87 88 89 90 91 92 |
# File 'ui/src/hokusai/types.rb', line 87 def initialize(top, right, bottom, left) @top = top @left = left @right = right @bottom = bottom end |
Instance Attribute Details
#bottom ⇒ Object (readonly) Also known as: b
Returns the value of attribute bottom.
86 87 88 |
# File 'ui/src/hokusai/types.rb', line 86 def bottom @bottom end |
#left ⇒ Object (readonly) Also known as: l
Returns the value of attribute left.
86 87 88 |
# File 'ui/src/hokusai/types.rb', line 86 def left @left end |
#right ⇒ Object (readonly) Also known as: r
Returns the value of attribute right.
86 87 88 |
# File 'ui/src/hokusai/types.rb', line 86 def right @right end |
#top ⇒ Object (readonly) Also known as: t
Returns the value of attribute top.
86 87 88 |
# File 'ui/src/hokusai/types.rb', line 86 def top @top end |
Class Method Details
.convert(value) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'ui/src/hokusai/types.rb', line 99 def self.convert(value) case value when String if value =~ /,/ convert(value.split(",").map(&:to_f)) else convert(value.to_i) end when Integer new(value, value, value, value) when Array new(value[0], value[1], value[2], value[3]) when Padding value else raise Hokusai::Error.new("Unsupported conversion type #{value.class} for Hokusai::Padding") end end |
Instance Method Details
#hash ⇒ Object
118 119 120 |
# File 'ui/src/hokusai/types.rb', line 118 def hash [self.class, top, right, bottom, left].hash end |