class XCAssetsCop::ConfigOptions

Constants

ALLOWED_KEYS

Attributes

file_extension[R]
image_scale[R]
preserves_vector_representation[R]
same_file_and_asset_name[R]
template_rendering_intent[R]

Public Class Methods

new(obj) click to toggle source
# File lib/xcassetscop/config_options.rb, line 20
def initialize(obj)
  ensure_all_keys_are_allowed obj
  @file_extension = obj.sdig('file_extension')
  @image_scale = obj.sdig('image_scale')
  @same_file_and_asset_name = obj.sdig('same_file_and_asset_name')
  @template_rendering_intent = obj.sdig('template_rendering_intent')
  @preserves_vector_representation = obj.sdig('preserves_vector_representation')
end

Private Instance Methods

ensure_all_keys_are_allowed(obj) click to toggle source
# File lib/xcassetscop/config_options.rb, line 31
def ensure_all_keys_are_allowed(obj)
  diff = obj.keys.map(&:to_sym) - ALLOWED_KEYS
  raise StandardError, "Unexpected key#{'s' if diff.size > 1}: #{diff.map { |s| "'#{s}'" }.join(', ')}" if diff.size.positive?
end
validate() click to toggle source
# File lib/xcassetscop/config_options.rb, line 36
def validate
  TemplateRenderingIntent.validate @template_rendering_intent if @template_rendering_intent
  ImageScale.validate @image_scale if @template_rendering_intent
end