classy-yaml 1.2 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18499d16c6513652c6424bf8ff1cf2ec887b26a50a28f1d1a16b317f74a63ce4
4
- data.tar.gz: ee602d76c693f54041c07548c5634760c9ccba8c74746177d7d22207148a590f
3
+ metadata.gz: 44e2f7822c0f2aa82a9298e436eeacea743242aebeab4c3341031cbccf371303
4
+ data.tar.gz: f914bb219e0ff3053fcab221ca93213f734f8c46a25aebbe1e1aa40ed9eccb2b
5
5
  SHA512:
6
- metadata.gz: 16aa91f99106e901e9561f5e1d41a454999dfaefdeac7557becbc6d1ecf32cec6a6d306c2904b8981b2efbb75e7ca2bfd74af4b96521a37a3ae5ae9b0ece8fbb
7
- data.tar.gz: 8696d46b02167e605ecaa5d74117f51dae9563595f9b87c94cf5f856b39bb979df19d5414e9e36924b99ba45bb4579d51741d02d9fab159fdd5595c6e2852236
6
+ metadata.gz: bc8c22cbd96a1ea9a595a827d7ebad63e9dcbc7a64abcd18b969634a0f363f036b5bc65dc3045a0b3d5c4c966d610db8068d4853af98a9554e4731c0aae0674c
7
+ data.tar.gz: 270d543c957326fc4902a9ff245a887cb1f6faaa62240c78edeffc9800070a8ac345b83b8554ec6c89d9e21faed18c242215548e51d2b6021465988d8eb9a661
@@ -7,11 +7,17 @@ module Classy
7
7
  component_name = self.class.name.underscore.split("/").last.split(".").first
8
8
 
9
9
  classy_files = ["#{calling_path}/#{component_name}.yml",
10
- "#{calling_path}/#{calling_file}/#{calling_file}.yml",
11
- "#{calling_path}/#{calling_file}/#{component_name}.yml"
10
+ "#{calling_path}/#{calling_file}/#{calling_file}.yml",
11
+ "#{calling_path}/#{calling_file}/#{component_name}.yml"
12
12
  ]
13
13
 
14
- helpers.yass(args, classy_files: classy_files.uniq)
14
+ if args.first.is_a?(Hash)
15
+ args.first.merge!({ classy_files: classy_files.uniq })
16
+ else
17
+ args << { classy_files: classy_files.uniq }
18
+ end
19
+
20
+ helpers.yass(*args)
15
21
  end
16
22
  end
17
23
  end
@@ -3,6 +3,14 @@ module Classy
3
3
  module Helpers
4
4
  def yass(*args)
5
5
  classy_yamls = []
6
+
7
+ Classy::Yaml.engine_files.each do |file|
8
+ if File.exist?(file) && YAML.load_file(file)
9
+ file = YAML.load_file(file)
10
+ classy_yamls << file if file
11
+ end
12
+ end
13
+
6
14
  classy_yamls << YAML.load_file(Rails.root.join(Classy::Yaml.default_file)) if File.exist?(Rails.root.join(Classy::Yaml.default_file))
7
15
 
8
16
  classy_files_hash = args.find { |arg| arg.is_a?(Hash) && arg.keys.include?(:classy_files) } || { classy_files: [] }
@@ -88,7 +96,6 @@ module Classy
88
96
  classes.reject!(&:blank?)
89
97
  return classes.flatten.uniq
90
98
  end
91
-
92
99
  end
93
100
  end
94
101
  end
@@ -1,5 +1,5 @@
1
1
  module Classy
2
2
  module Yaml
3
- VERSION = '1.2'
3
+ VERSION = '1.3.0'
4
4
  end
5
5
  end
data/lib/classy/yaml.rb CHANGED
@@ -6,6 +6,9 @@ module Classy
6
6
  mattr_accessor :default_file
7
7
  @@default_file = "config/utility_classes.yml"
8
8
 
9
+ mattr_accessor :engine_files
10
+ @@engine_files = []
11
+
9
12
  mattr_accessor :extra_files
10
13
  @@extra_files = []
11
14
 
@@ -13,6 +16,10 @@ module Classy
13
16
  autoload :ComponentHelpers, "classy/yaml/component_helpers"
14
17
  autoload :InvalidKeyError, "classy/yaml/invalid_key_error"
15
18
 
19
+ def self.engine_files=(value)
20
+ @@engine_files = Array.wrap(value).reject(&:blank?).map { |file| Rails.root.join(file) }
21
+ end
22
+
16
23
  def self.extra_files=(value)
17
24
  @@extra_files = Array.wrap(value).reject(&:blank?).map { |file| Rails.root.join(file) }
18
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classy-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.2'
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tonksthebear
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-03-28 00:00:00.000000000 Z
11
+ date: 2024-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport