Module: Imgix::ParamHelpers

Included in:
Path
Defined in:
lib/imgix/param_helpers.rb

Instance Method Summary collapse

Instance Method Details

#rect(position) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/imgix/param_helpers.rb', line 5

def rect(position)
  @options[:rect] = position and return self if position.is_a?(String)

  @options[:rect] = [
    position[:x] || position[:left],
    position[:y] || position[:top],
    position[:width] || (position[:right] - position[:left]),
    position[:height] || (position[:bottom] - position[:top])
  ].join(',')

  return self
end