conifer 1.3.0 → 2.0.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: '09ced739ff40c2e3f5b4bc60431dfd578a4a700aed77be41aeb84ea0e62677c1'
4
- data.tar.gz: 0f8950a612acf6f0b3b2ee1a0bf9f9414c68cf541f4fcb89ee0b144721070f53
3
+ metadata.gz: 6d91f2c9c3d4253a4772d4a5a9cbca13f5a3313b4158e598929aa0797e6e9f0d
4
+ data.tar.gz: b21e1ae6db73299773d4cb7804fb83ef9c0febe3d68b7cf4cd6269de12b3ad9e
5
5
  SHA512:
6
- metadata.gz: a981b2691bffaabc70e2c79d3d58b00c811bafb06ec47f3d7b6560aa057ef883e6231d03555f677c3c17c5995e001194eeab4bb1549be5554d1d8835b0c8a7dc
7
- data.tar.gz: 7de081b9c44c12a4cbfb8201c39ea77fc3b0d1477c75a4f1518632d569363eedf59c3f24a105f6c0512bbfe17ef3894cb3204581fd9d93c35d51dbd55cdb6c5f
6
+ metadata.gz: 5863b2cdefb74a782c170d366c97bc1917cddafd24d95cda9423585b16b7db991a01fd3cc9f0dd649d727e934fca9abe1d652cdc3a0145a4e4d5180787e65df2
7
+ data.tar.gz: a76f8bc190504af328f4a20aac8377c64a3995aab245e1dfcb139cdc7e2f76ce55b09a7021362a44265633ce70bd2ec43bbbce7baffd44d70498703505c950eb
data/.tool-versions CHANGED
@@ -1 +1 @@
1
- ruby 3.1.0
1
+ ruby 3.1.2
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- conifer (1.3.0)
4
+ conifer (2.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -56,6 +56,7 @@ GEM
56
56
  PLATFORMS
57
57
  x86_64-darwin-19
58
58
  x86_64-darwin-20
59
+ x86_64-darwin-21
59
60
  x86_64-linux
60
61
 
61
62
  DEPENDENCIES
data/lib/conifer/file.rb CHANGED
@@ -8,14 +8,14 @@ module Conifer
8
8
  NotFoundError = Class.new(StandardError)
9
9
  UnsupportedFormatError = Class.new(StandardError)
10
10
 
11
- attr_reader :name, :dir, :prefix, :format, :allowed_classes
11
+ attr_reader :name, :dir, :prefix, :format, :options
12
12
 
13
- def initialize(name, dir:, prefix: nil, format: :yml, allowed_classes: [])
13
+ def initialize(name, dir:, prefix: nil, format: :yml, **options)
14
14
  @name = name
15
15
  @dir = dir
16
16
  @prefix = prefix
17
17
  @format = format
18
- @allowed_classes = allowed_classes
18
+ @options = options
19
19
  end
20
20
 
21
21
  def [](key)
@@ -26,9 +26,9 @@ module Conifer
26
26
  def parsed
27
27
  @parsed ||= case format
28
28
  when :yml, :yaml
29
- YAML.safe_load(ERB.new(::File.read(path)).result, permitted_classes: allowed_classes)
29
+ YAML.safe_load(ERB.new(::File.read(path)).result, **options)
30
30
  when :json
31
- JSON.parse(ERB.new(::File.read(path)).result)
31
+ JSON.parse(ERB.new(::File.read(path)).result, **options)
32
32
  else
33
33
  raise UnsupportedFormatError, "Format '#{format}' is not supported"
34
34
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Conifer
4
- VERSION = '1.3.0'
4
+ VERSION = '2.0.0'
5
5
  end
data/lib/conifer.rb CHANGED
@@ -11,7 +11,7 @@ module Conifer
11
11
  # rubocop:disable Metrics/ParameterLists
12
12
  module ClassMethods
13
13
  def conifer(name, prefix: nil, dir: nil, format: :yml, method: ::File.basename(name.to_s, ".#{format}"),
14
- singleton: false, allowed_classes: [])
14
+ singleton: false, **options)
15
15
  dir ||= ::File.expand_path(::File.dirname(caller_locations.first.path))
16
16
 
17
17
  body = proc do
@@ -19,7 +19,7 @@ module Conifer
19
19
 
20
20
  instance_variable_set "@conifer_#{method}",
21
21
  Conifer::File.new(name, prefix: prefix, format: format,
22
- dir: dir, allowed_classes: allowed_classes).tap(&:validate!)
22
+ dir: dir, **options).tap(&:validate!)
23
23
  end
24
24
 
25
25
  singleton ? define_singleton_method(method, &body) : define_method(method, &body)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: conifer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-26 00:00:00.000000000 Z
11
+ date: 2022-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.3.3
144
+ rubygems_version: 3.3.7
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Conifer allows you to easily manage YAML configuration files and import them