4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/classy/yaml/helpers.rb', line 4
def yass(*args)
classy_yamls = []
Classy::Yaml.engine_files.each do |file|
if File.exist?(file) && YAML.load_file(file)
file = YAML.load_file(file)
classy_yamls << file if file
end
end
classy_yamls << YAML.load_file(Rails.root.join(Classy::Yaml.default_file)) if File.exist?(Rails.root.join(Classy::Yaml.default_file))
classy_files_hash = args.find { |arg| arg.is_a?(Hash) && arg.keys.include?(:classy_files) } || { classy_files: [] }
(classy_files_hash[:classy_files] + Classy::Yaml.).each do |file|
if File.exist?(file) && YAML.load_file(file)
file = YAML.load_file(file)
classy_yamls << file if file
end
end
return if classy_yamls.blank?
skip_base_hash = args.find { |arg| arg.is_a?(Hash) && arg.keys.include?(:skip_base) } || {}
keys, classes = flatten_args(values: args)
classes += fetch_classes(keys, classy_yamls: classy_yamls, skip_base: skip_base_hash[:skip_base])
return classes.flatten.join(" ")
end
|