camille 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9ebcd5a9f0f1efd10108a596a8e4e442eb5afd3975728cd2ec51319563ae504e
4
- data.tar.gz: '0889d8c954ef2983e27f7b9d97d396db0edb46251b6b55febc1f1427e9c3391f'
3
+ metadata.gz: a587c953d4d716329e30ee94c7dfd2b67fcbb9d95b6aee5acc3a74ba7d8e2883
4
+ data.tar.gz: 28cf879c56d17ac119c2913c14d2ce09548c226b8f9120aa5fd5ccc3ab8334d0
5
5
  SHA512:
6
- metadata.gz: 5247e53a9b76e8117247ef8d5e7c83d27cb57b3c8bf4971a5ee978e168e1e1e1c58a1348522ec7d2a4ab530d958d044c7c670a464e5cd5c02fadf046284e97c4
7
- data.tar.gz: b64ab07566a56d4e407ec887af105493b4af9dd99c0fa4c1e32de32fce6e54d9e78ca375ba59377f8cecd0002f27bfc6822de2635612345ff67ea67efa305466
6
+ metadata.gz: 64ca501f703b329e9c4a8872a237480a4a751ffdbb82cadfc7ca67a31fcaffffd6c18c26d5eff045f69600c6bf2e6f82c9607b47ce83dbb9333a5b6d67f40692
7
+ data.tar.gz: 5d8951b905ad94aecc0b10756c9ff16bb25f9b6ee791c57694ad7bfdfd2f0c27cebe6e980b975f3a0cb17b3afa25a750d0808cfad221729e7d1c50caeba20e8e
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- camille (0.5.3)
4
+ camille (0.5.4)
5
5
  rails (>= 6.1, < 8)
6
6
 
7
7
  GEM
@@ -1,6 +1,7 @@
1
1
  module Camille
2
2
  module Types
3
3
  class Object < Camille::BasicType
4
+ class ArgumentError < ::ArgumentError; end
4
5
  attr_reader :fields
5
6
 
6
7
  def initialize fields
@@ -43,6 +44,7 @@ module Camille
43
44
  private
44
45
  def normalize_fields fields
45
46
  fields.map do |key, value|
47
+ check_case_conversion_safe key
46
48
  type = Camille::Type.instance(value)
47
49
  if key.end_with?('?')
48
50
  new_key = remove_question_mark(key)
@@ -57,6 +59,13 @@ module Camille
57
59
  def remove_question_mark sym
58
60
  sym.to_s.gsub(/\?$/, '').to_sym
59
61
  end
62
+
63
+ def check_case_conversion_safe sym
64
+ str = sym.to_s
65
+ if str != str.camelize.underscore
66
+ raise ArgumentError.new("Only keys satisfying `key.to_s == key.to_s.caamelize.underscore` can be used.")
67
+ end
68
+ end
60
69
  end
61
70
  end
62
71
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Camille
4
- VERSION = "0.5.4"
4
+ VERSION = "0.5.5"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: camille
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
4
+ version: 0.5.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - 辻彩
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-12 00:00:00.000000000 Z
11
+ date: 2023-05-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails