csp-util 1.0.2 → 1.1.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: 541626754ec321c45e1140c383c0c3848fee01ccd6d814055b72713845a8ffed
4
- data.tar.gz: ad1604712fa929d9d753e213709b9c998be4e5416ee7442918caea86aa5ab227
3
+ metadata.gz: 973e6b8fb98154dde0ede0195239e6974d647ddf9787853cf2ac588b9af4e726
4
+ data.tar.gz: 630209282c527e0f137bdff3196c1a5c8652853596ef941456f38d0ae845c09a
5
5
  SHA512:
6
- metadata.gz: 96f5afc3ae55b1b7727cc74fcd50cf3fe60dd5e33cda1664d44446f0f64a67ecfdda342892610b2ce850f0ba1e93f384ccb417da4b1d51aa9e7df3fc7de23893
7
- data.tar.gz: b7afbc2ca5d3a4778f62b2659edca6c2c8428f1d5aa9b23ceb3f336de31670d4cbd01b9b3f80c17519de08a3400ce59b68af10b2dcbad99ed32b360d315b4915
6
+ metadata.gz: 33be4aa362dd9670036da991d8db6dd15c82d1110239294461049520c04ecff87a1328b674d79329ab86e1173d1481a7056420f6108218907db76fa72ffcdb5d
7
+ data.tar.gz: 81b1d97f0835daa75da66182f48e81646551e1959810d0f79c2ddc938fb5139b9a38d224588330f4308c8edf4343762c4df583ca5db4275801036a5a7bd55a0d
@@ -40,6 +40,10 @@ module CSPUtil
40
40
  { name: name, value: value }
41
41
  end
42
42
 
43
+ def to_s
44
+ [name, value.join(' ')].reject(&:empty?).join(' ')
45
+ end
46
+
43
47
  private
44
48
 
45
49
  def validate_name!(directive_name)
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module CSPUtil
4
+ class << self
5
+ def join_directives(directives)
6
+ directives.map(&:to_s).join('; ')
7
+ end
8
+ end
9
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CSPUtil
4
- VERSION = '1.0.2'.freeze
4
+ VERSION = '1.1.0'
5
5
  end
data/lib/csp_util.rb CHANGED
@@ -2,4 +2,5 @@
2
2
 
3
3
  require_relative 'csp_util/errors'
4
4
  require_relative 'csp_util/directive'
5
+ require_relative 'csp_util/join_directives'
5
6
  require_relative 'csp_util/parse_directives'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: csp-util
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Templarbit
@@ -84,6 +84,7 @@ files:
84
84
  - lib/csp_util.rb
85
85
  - lib/csp_util/directive.rb
86
86
  - lib/csp_util/errors.rb
87
+ - lib/csp_util/join_directives.rb
87
88
  - lib/csp_util/parse_directives.rb
88
89
  - lib/csp_util/version.rb
89
90
  homepage: https://github.com/templarbit/ruby-csp-util