Add remaining FileResource methods

This commit is contained in:
Brandon Robins
2017-10-28 11:44:22 -05:00
parent 082b3c98e8
commit d22932c877
3 changed files with 342 additions and 4 deletions

View File

@@ -18,5 +18,21 @@ module Calligraphy
def split_and_pop(path:, separator: '/')
path.split(separator)[0..-2]
end
def obj_exists_and_is_not_type?(obj:, type:)
obj.nil? ? false : obj != type
end
def map_array_of_hashes(arr_hashes)
[].tap do |output_array|
arr_hashes.each do |hash|
output_array.push hash.map { |k, v| v }
end
end
end
def extract_lock_token(if_header)
if_header.scan(Calligraphy::LOCK_TOKEN_REGEX)&.flatten[0]
end
end
end