kamisaku 0.4.3 → 0.4.5

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: cfdf7ddf6a45f5c5794ad3e1e820b07e38ab7ad24188cca2c9fcf637ccdb0ef1
4
- data.tar.gz: 1cc9d43c15c69a760d22bb78f77b7d8e3e75f38005686f3e38f48f9adfcb16f2
3
+ metadata.gz: 2998be93b0d3bcc24cfcd15f35718cbbc102817f54f887122543885a251cb0aa
4
+ data.tar.gz: 41ea9e2d8bcaecd42bd9a2c1b60f875f59c8995fb9ed94013e2d5d5636e2c36c
5
5
  SHA512:
6
- metadata.gz: 9dae789b198dd96799c93261b6351c5f720d45ca3612f8df2fcb46df161b5ccee25b5d9bdf8a9cbaa341e7a5ffaccca0021eedab62ff7c6571f94da388eded5a
7
- data.tar.gz: 2600ff04de0ce42018a5a1148c52d3a0ed9ff9af9ba96a810bc20d4eecfec982abbc32c8a67b0427458b7071bf26e23fbbd7a4994f60c65697ecd1742187fcac
6
+ metadata.gz: 2576f1805c9e72c8a668e0f70360febb6c763123117b28b55a49da062106fe750e094c2e5089ce4062198fbd0cd9bcad5c857a4d9faeb995a8035f8441ed8f54
7
+ data.tar.gz: a7ba350009aabc7bcd259d4c451059a31c602edf409a59c1204fc8bfb531984d7ab42a820a8b22cbcb19d000c996fb6746a409e70cfb39687fd57440dd4aa24f
data/CHANGELOG.md CHANGED
@@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.5] - 2026.01.03
9
+
10
+ ### Changed
11
+ - Fix `Kamisaku::PDF` validation for category and template
12
+
13
+ ## [0.4.4] - 2026.01.01
14
+
15
+ ### Changed
16
+ - Improve error handling in `yaml_str_to_content_hash` and `BaseContentValidator`
17
+
8
18
  ## [0.4.3] - 2026.01.01
9
19
 
10
20
  ### Changed
data/Gemfile.lock CHANGED
@@ -1,25 +1,25 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kamisaku (0.4.3)
4
+ kamisaku (0.4.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
9
  ast (2.4.3)
10
- json (2.12.0)
10
+ json (2.18.0)
11
11
  language_server-protocol (3.17.0.5)
12
- minitest (5.25.5)
12
+ minitest (5.27.0)
13
13
  parallel (1.27.0)
14
- parser (3.3.8.0)
14
+ parser (3.3.10.0)
15
15
  ast (~> 2.4.1)
16
16
  racc
17
- prism (1.4.0)
17
+ prism (1.7.0)
18
18
  racc (1.8.1)
19
19
  rainbow (3.1.1)
20
- rake (13.2.1)
21
- regexp_parser (2.10.0)
22
- rexml (3.4.1)
20
+ rake (13.3.1)
21
+ regexp_parser (2.11.3)
22
+ rexml (3.4.4)
23
23
  rubocop (1.57.2)
24
24
  json (~> 2.3)
25
25
  language_server-protocol (>= 3.17.0)
@@ -31,9 +31,9 @@ GEM
31
31
  rubocop-ast (>= 1.28.1, < 2.0)
32
32
  ruby-progressbar (~> 1.7)
33
33
  unicode-display_width (>= 2.4.0, < 3.0)
34
- rubocop-ast (1.44.1)
34
+ rubocop-ast (1.49.0)
35
35
  parser (>= 3.3.7.2)
36
- prism (~> 1.4)
36
+ prism (~> 1.7)
37
37
  rubocop-minitest (0.33.0)
38
38
  rubocop (>= 1.39, < 2.0)
39
39
  rubocop-rake (0.6.0)
@@ -4,6 +4,7 @@ module Kamisaku
4
4
  alias_method :data, :content_hash
5
5
 
6
6
  def initialize(content_hash:)
7
+ raise Kamisaku::Error, "content is not a Hash" unless content_hash.is_a? Hash
7
8
  @content_hash = content_hash
8
9
  end
9
10
 
@@ -3,7 +3,9 @@ require "psych"
3
3
  module Kamisaku
4
4
  module Helpers
5
5
  def self.yaml_str_to_content_hash(yaml_str)
6
- Psych.safe_load(yaml_str, symbolize_names: true, aliases: false, freeze: true)
6
+ result = Psych.safe_load(yaml_str, symbolize_names: true, aliases: false, freeze: true)
7
+ raise Kamisaku::Error, "Unable to parse yaml content" unless result.is_a?(Hash)
8
+ result
7
9
  rescue Psych::SyntaxError => error
8
10
  raise Kamisaku::Error, "Syntax error at line #{error.line}"
9
11
  rescue Psych::AliasesNotEnabled => _error
data/lib/kamisaku/pdf.rb CHANGED
@@ -14,11 +14,17 @@ module Kamisaku
14
14
  @category = category.to_sym
15
15
  @template = template.to_sym
16
16
 
17
- raise Error, "Invalid template name '#{template}'" unless template.is_a?(String)
18
17
  validator_klass = CONTENT_VALIDATOR_MAP[@category]
19
- raise Error, "Invalid template name '#{@category}'" unless validator_klass
18
+
19
+ unless validator_klass
20
+ raise Error, "Invalid category '#{@category}'"
21
+ end
22
+
23
+ unless validator_klass::TEMPLATES.include?(@template)
24
+ raise Error, "Invalid template '#{@template}'"
25
+ end
26
+
20
27
  validator_klass.new(content_hash:).validate!
21
- raise Error, "Invalid template name '#{@template}'" unless validator_klass::TEMPLATES.include?(@template)
22
28
  end
23
29
 
24
30
  def write_to(pdf_location)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kamisaku
4
- VERSION = "0.4.3"
4
+ VERSION = "0.4.5"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamisaku
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sinaru Gunawardena