Method: Fleximage::Operator::Base.size_to_xy

Defined in:
lib/fleximage/operator/base.rb

.size_to_xy(size) ⇒ Object

Allows access to size conversion globally. See size_to_xy for a more detailed explanation



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/fleximage/operator/base.rb', line 56

def self.size_to_xy(size)
  case          
  when size.is_a?(Array) && size.size == 2  # [320, 240]
    size

  when size.to_s.include?('x')              # "320x240"
    size.split('x').collect(&:to_i)
  
  else # Anything else, convert the object to an integer and assume square dimensions
    [size.to_i, size.to_i]
    
  end
end