Method: AssetType#configured_styles

Defined in:
app/models/asset_type.rb

#configured_stylesObject

Paperclip styles are defined in the config entry ‘assets.thumbnails.asset_type`, with the format: foo:key-x,key=y,key=z|bar:key-x,key=y,key=z where ’key’ can be any parameter understood by your paperclip processors. Usually they include :geometry and :format. A typical entry would be:

standard:geometry=640x640>,format=jpg

This method parses that string and returns the defined styles as a hash of style-defining strings that will later be normalized into hashes.



144
145
146
147
148
149
150
151
152
153
# File 'app/models/asset_type.rb', line 144

def configured_styles
  @configured_styles ||= if style_definitions = TrustyCms.config["assets.thumbnails.#{name}"]
                           style_definitions.split('|').each_with_object({}) do |definition, styles|
                             name, rule = definition.split(':')
                             styles[name.strip.to_sym] = rule.to_s.strip
                           end
                         else
                           {}
  end
end