Class: InlineSvg::TransformPipeline::Transformations::Size
Instance Attribute Summary
#value
Instance Method Summary
collapse
create_with_value, #initialize, #with_svg
Instance Method Details
#height_of(value) ⇒ Object
14
15
16
|
# File 'lib/inline_svg/transform_pipeline/transformations/size.rb', line 14
def height_of(value)
value.split(/\*/).map(&:strip)[1] || width_of(value)
end
|
3
4
5
6
7
8
|
# File 'lib/inline_svg/transform_pipeline/transformations/size.rb', line 3
def transform(doc)
with_svg(doc) do |svg|
svg["width"] = width_of(self.value)
svg["height"] = height_of(self.value)
end
end
|
#width_of(value) ⇒ Object
10
11
12
|
# File 'lib/inline_svg/transform_pipeline/transformations/size.rb', line 10
def width_of(value)
value.split(/\*/).map(&:strip)[0]
end
|