Sha256: 739e5b37832f42e82c41d3d9ea56941b4015d3f79dc8c26005d42e9191fab421
Contents?: true
Size: 1.11 KB
Versions: 4
Compression:
Stored size: 1.11 KB
Contents
module OpenXml module DrawingML module Properties class Tile < OpenXml::Properties::ComplexProperty namespace :a tag :tile RECTANGLE_ALIGNMENTS = %i{ b bl br ctr l r t tl tr }.freeze attribute :alignment, displays_as: :algn, one_of: RECTANGLE_ALIGNMENTS attribute :flip, one_of: %i{ none x xy y } attribute :horizontal_ratio, displays_as: :sx, expects: :percentage attribute :vertical_ratio, displays_as: :sy, expects: :percentage attribute :horizontal_offset, displays_as: :tx, expects: :coordinate attribute :vertical_offset, displays_as: :ty, expects: :coordinate private def coordinate(value) message = "Invalid coordinate: should either be an integer (in EMUs) or include a unit" raise ArgumentError, message unless integer?(value) || valid_coordinate?(value) end def valid_coordinate?(value) value.is_a?(String) && value =~ /-?[0-9]+(\.[0-9]+)?(mm|cm|in|pt|pc|pi)/ end def integer?(value) value.is_a?(Integer) end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems