Module: Plushie::Type::LineHeight
- Defined in:
- lib/plushie/type/line_height.rb
Overview
Line height for text widgets.
Accepts three forms:
- A number (relative multiplier, e.g. 1.5)
- +n+ for explicit relative line height
- +n+ for absolute pixel line height
Numbers are passed through as-is (the renderer interprets plain numbers as relative multipliers). Maps are passed through so the renderer can distinguish the two explicit forms.
Class Method Summary collapse
-
.encode(value) ⇒ Numeric, ...
Encode a line height value for the wire protocol.
Class Method Details
.encode(value) ⇒ Numeric, ...
Encode a line height value for the wire protocol.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/plushie/type/line_height.rb', line 27 def encode(value) case value when Numeric then value when Hash if value.key?(:relative) || value.key?(:absolute) value else raise ArgumentError, "line_height hash must have :relative or :absolute key, got: #{value.inspect}" end when nil then nil else raise ArgumentError, "invalid line_height: #{value.inspect}" end end |