module Collins::Asset::Update
Params we know about for updates, others come in via attribute hash
Constants
- ALL_PARAMS
- FILE_PARAMS
- NON_ATTRIBUTE_PARAMS
Public Class Methods
get_param(key)
click to toggle source
# File lib/collins/asset_update.rb, line 38 def get_param key to_a.each do |k| if k.is_a?(Regexp) && !k.match(key).nil? then # Assume it's a power setting until we have >1 regexp return key.upcase elsif key.to_s.downcase == k.to_s.downcase then return k end end return key end
get_param_value(key, value)
click to toggle source
# File lib/collins/asset_update.rb, line 20 def get_param_value key, value if is_file_param?(key) then if value.start_with?('@') then filename = File.expand_path(value[1..-1]) if !File.readable?(filename) then msg = "Could not read file '#{filename}' for key '#{key}'" raise ::Collins::ExpectationFailedError.new msg else File.read(filename) end else value end else value end end
is_attribute?(key)
click to toggle source
# File lib/collins/asset_update.rb, line 54 def is_attribute? key to_a.each do |k| if k.is_a?(Regexp) && !k.match(key).nil? then return false elsif key.to_s.downcase == k.to_s.downcase then return false end end return true end
is_file_param?(key)
click to toggle source
# File lib/collins/asset_update.rb, line 50 def is_file_param? key FILE_PARAMS.map{|k|k.to_s.downcase}.include?(key.to_s.downcase) end
to_a()
click to toggle source
# File lib/collins/asset_update.rb, line 16 def to_a Collins::Asset::Update::ALL_PARAMS end