codeclimate-yaml 0.2.2 → 0.2.3

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
  SHA1:
3
- metadata.gz: 635473b8db0a7d23ad458dcfbee10c2cc8057d13
4
- data.tar.gz: 3a671158391d8039a99c6895978f493be22aef3e
3
+ metadata.gz: 8744a4c6ac64def6988bfdcd0b4ffb820e3d54ee
4
+ data.tar.gz: 1e6901cf5ed4cdd3cf28fcfb7e7f25728145ad2d
5
5
  SHA512:
6
- metadata.gz: 1d0f7a03b47f158303aad0c95ba52848451f7b49774b05a2ac73cf85c6c2640ca7eeb226b947a5d92ab2eae301095e6faafc9a3a7d6af71c48fca1cc884480ac
7
- data.tar.gz: 72b66cfa36f7f3ab3f939ce6e7f3462c09e6f2f7ce9e5b7d148fd2041ac7bc29a12c9bfc3bd52399eb3b1f96f25e30ca9344f3b6a4bb2340438d8bffc8828d97
6
+ metadata.gz: 5c1ea958544066b658210a893375fef2137cec9f2ec62a5b236b59e8336cd3c65679d68b216fbc4a696412c87d2ce7258e3a1ddc1775b23387339142ce3337ba
7
+ data.tar.gz: d8b3704063ac92cdbf72437d354ac3c5c99ddb9fdfa213f4972fd05bd5e7a14eef461b528caedde8f81fb4fd0bfb1eea9482ebe3c6045a5bae2a3b0c2d7fa3bf
@@ -4,6 +4,7 @@ module CC
4
4
  class Engine < Mapping
5
5
  map :enabled, to: Scalar[:bool], required: true
6
6
  map :checks, to: Checks
7
+ map :config, to: EngineConfig
7
8
  end
8
9
  end
9
10
  end
@@ -0,0 +1,9 @@
1
+ module CC
2
+ module Yaml
3
+ module Nodes
4
+ class EngineConfig < OpenMapping
5
+ prefix_scalar :file
6
+ end
7
+ end
8
+ end
9
+ end
@@ -39,6 +39,18 @@ module CC::Yaml
39
39
  mapping[aliases.fetch(key.to_s, key.to_s)]
40
40
  end
41
41
 
42
+ def self.prefix_scalar(key = nil, *types)
43
+ @prefix_scalar ||= superclass.respond_to?(:prefix_scalar) ? superclass.prefix_scalar : nil
44
+ if key
45
+ @prefix_scalar = key.to_s
46
+ define_method(:visit_scalar) do |visitor, type, value, _implicit = true|
47
+ return super(visitor, type, value, _implicit = true) if types.any? && !types.include?(type)
48
+ visit_key_value(visitor, key, value)
49
+ end
50
+ end
51
+ @prefix_scalar
52
+ end
53
+
42
54
  attr_reader :mapping
43
55
  alias_method :__getobj__, :mapping
44
56
 
data/lib/cc/yaml/nodes.rb CHANGED
@@ -4,6 +4,7 @@ module CC
4
4
  autoload :Check, "cc/yaml/nodes/check"
5
5
  autoload :Checks, "cc/yaml/nodes/checks"
6
6
  autoload :Engine, "cc/yaml/nodes/engine"
7
+ autoload :EngineConfig, "cc/yaml/nodes/engine_config"
7
8
  autoload :EngineList, "cc/yaml/nodes/engine_list"
8
9
  autoload :Glob, "cc/yaml/nodes/glob"
9
10
  autoload :GlobList, "cc/yaml/nodes/glob_list"
@@ -1,5 +1,5 @@
1
1
  module CC
2
2
  module Yaml
3
- VERSION = "0.2.2".freeze
3
+ VERSION = "0.2.3".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: codeclimate-yaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
@@ -49,6 +49,7 @@ files:
49
49
  - lib/cc/yaml/nodes/check.rb
50
50
  - lib/cc/yaml/nodes/checks.rb
51
51
  - lib/cc/yaml/nodes/engine.rb
52
+ - lib/cc/yaml/nodes/engine_config.rb
52
53
  - lib/cc/yaml/nodes/engine_list.rb
53
54
  - lib/cc/yaml/nodes/glob.rb
54
55
  - lib/cc/yaml/nodes/glob_list.rb