Class: Imgproxy::OptionsCasters::Group

Inherits:
Object
  • Object
show all
Defined in:
lib/imgproxy/options_casters/group.rb

Overview

Casts group of options and trim nils from the end

Instance Method Summary collapse

Constructor Details

#initialize(extractors) ⇒ Group

Returns a new instance of Group.



11
12
13
# File 'lib/imgproxy/options_casters/group.rb', line 11

def initialize(extractors)
  @extractors = extractors
end

Instance Method Details

#cast(raw) ⇒ Object



15
16
17
18
19
20
# File 'lib/imgproxy/options_casters/group.rb', line 15

def cast(raw)
  values = @extractors.map do |key, extractor|
    extractor.cast(raw[key])
  end
  values.trim!
end