Method: HexaPDF::Layout::Style.create
- Defined in:
- lib/hexapdf/layout/style.rb
.create(style) ⇒ Object
:call-seq:
Style.create(style) -> style
Style.create(properties_hash) -> style
Creates a Style object based on the style argument and returns it:
-
If
styleis already a Style object, it is just returned. -
If
styleis a hash, a new Style object with the style properties specified by the hash -
is created.
-
If
styleisnil, a new Style object with only default values is created.
580 581 582 583 584 585 586 587 |
# File 'lib/hexapdf/layout/style.rb', line 580 def self.create(style) case style when self then style when Hash then new(**style) when nil then new else raise ArgumentError, "Invalid argument class #{style.class}" end end |