Method: Cat::Style::Size#initialize

Defined in:
lib/cat/style/size.rb

#initialize(width, height = nil) ⇒ Size

Returns a new instance of Size.



4
5
6
7
8
9
10
11
# File 'lib/cat/style/size.rb', line 4

def initialize(width, height = nil)
  @width = width
  @height = height || width
  @width = "#{@width}px" if @width.is_a?(Integer)
  @height = "#{@height}px" if @height.is_a?(Integer)
  @width = '100px' unless (@width =~ /px|%|em|rem$/) > 0
  @height = '100px' unless (@height =~ /px|%|em|rem$/) > 0
end