rbs_activemodel 1.4.0 → 1.4.1

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: 0c967f4e7e9fb2fc4c3a5d3a7be3019280e9ee9a8b4653b536cabd1f38512165
4
- data.tar.gz: 5f936185b9e6cf7d635beab513a866239a637035f5e22a89576b6bb7ff581372
3
+ metadata.gz: 1e505f32754d95ee6e0b0588c1c4e29eb1886f7815541a3cff9316e5425ffafe
4
+ data.tar.gz: bf675d5783c2983cac9a59f448ea2ec9bcab0e99a4da8451f9305bc3a4b5d5e7
5
5
  SHA512:
6
- metadata.gz: 67c5c12236845803dd060cf0121a57ab426a32b68194ce1150745a2e3fa2ec75aa4618d62bde4dde0b47a78382e2c7875b08e15ef88a1b1c45760c3bac378cd7
7
- data.tar.gz: cd91a15201756ec4af1c621e213b744bfe85ae2cbb48f21229aa4b1c659c5f6468b0036f9e3ed113383092efc2c6db688038f5fe4fb651a8d45edaafcc7a3d92
6
+ metadata.gz: 4eacf6b6a9c5fa22698a011d14d91db2767fdb07ea5a0c85e6ca8c65759ac6bb861f7c47bf1325512d043cca5271baac132c9d92a90abb04c5220106a8f38934
7
+ data.tar.gz: 75660cc87d4927e3cfa514760689e1c992690404b1e4465bec2063ea1487da905dff590f6f83f3bb5f50215198c8417b8bfea5366bb5b71d798c25c300e3c942
@@ -0,0 +1,14 @@
1
+ #!/bin/bash
2
+ set -eu
3
+
4
+ if [ "${CLAUDE_CODE_REMOTE:-}" = "true" ]; then
5
+ eval "$(rbenv init - bash)"
6
+
7
+ # Set the latest installed Ruby version as the global default
8
+ rbenv global `rbenv versions --bare | sort -rV | head -1`
9
+
10
+ echo 'eval "$(rbenv init - bash)"' >> "$CLAUDE_ENV_FILE"
11
+ echo 'export RUBYOPT="-rcgi"' >> "$CLAUDE_ENV_FILE"
12
+ RUBYOPT="-rcgi" bundle install
13
+ bundle exec rbs collection install --frozen
14
+ fi
@@ -0,0 +1,73 @@
1
+ #!/bin/bash
2
+
3
+ # Hook input is JSON from stdin
4
+ input=$(cat)
5
+ tool_name=$(echo "$input" | jq -r '.tool_name')
6
+ command=$(echo "$input" | jq -r '.tool_input.command // ""')
7
+
8
+ # Only run for git commit commands
9
+ if [[ "$tool_name" != "Bash" ]] || [[ ! "$command" =~ git[[:space:]]+(commit|cherry-pick|merge|rebase) ]]; then
10
+ exit 0
11
+ fi
12
+
13
+ cd "$CLAUDE_PROJECT_DIR" || exit 1
14
+
15
+ if [ "${CLAUDE_CODE_REMOTE:-}" = "true" ]; then
16
+ eval "$(rbenv init - bash)"
17
+ fi
18
+
19
+ echo "Running pre-commit checks..." >&2
20
+
21
+ # Regenerate RBS from scratch so that files orphaned by deleted lib/ sources are dropped too
22
+ if ! bundle exec rake rbs:regenerate >&2; then
23
+ echo "Error: RBS generation failed" >&2
24
+ exit 2
25
+ fi
26
+
27
+ # True when $command stages the whole of sig/ itself, which the check below cannot see because
28
+ # this hook runs first. Staging only part of sig/ does not count - the rest still drops out.
29
+ stages_sig() {
30
+ local segment tokens token stages_everything pathspec_given
31
+
32
+ while IFS= read -r segment; do
33
+ segment=${segment//[\"\']/}
34
+ read -ra tokens <<<"${segment#*add}"
35
+ stages_everything=0
36
+ pathspec_given=0
37
+
38
+ for token in "${tokens[@]}"; do
39
+ case "$token" in
40
+ --) ;;
41
+ -*A*|--all) stages_everything=1 ;;
42
+ -*) ;;
43
+ .|./|sig|sig/|./sig|./sig/) return 0 ;;
44
+ *) pathspec_given=1 ;;
45
+ esac
46
+ done
47
+
48
+ # -A alone stages every path; given a pathspec it stages that path only
49
+ [ "$stages_everything" = 1 ] && [ "$pathspec_given" = 0 ] && return 0
50
+ done < <(grep -oE '(^|[;&|(])[[:space:]]*git[[:space:]]+add[^;&|(]*' <<<"$command")
51
+
52
+ return 1
53
+ }
54
+
55
+ # Stop rather than let the RBS just regenerated above drop out of the commit unnoticed
56
+ if [[ "$command" =~ git[[:space:]]+commit([[:space:]]|$) ]] && ! stages_sig; then
57
+ unstaged_sig=$(git status --porcelain --untracked-files=all -- sig/ | awk 'substr($0, 2, 1) != " "')
58
+
59
+ if [ -n "$unstaged_sig" ]; then
60
+ echo "Error: sig/ has changes that are not staged:" >&2
61
+ echo "$unstaged_sig" >&2
62
+ echo "Run 'git add sig/' and commit again." >&2
63
+ exit 2
64
+ fi
65
+ fi
66
+
67
+ if ! bundle exec rake >&2; then
68
+ echo "Error: rake checks failed" >&2
69
+ exit 2
70
+ fi
71
+
72
+ echo "All checks passed!" >&2
73
+ exit 0
@@ -0,0 +1,45 @@
1
+ #!/bin/bash
2
+ # Prevents direct editing of auto-generated RBS type definition files.
3
+ # Type definitions in the project's own sig/ are managed by PostToolUse hooks.
4
+ # Hand-written stubs for third-party gems under sig/gems/ are exempt.
5
+
6
+ # Hook input is JSON from stdin
7
+ input=$(cat)
8
+ tool_name=$(echo "$input" | jq -r '.tool_name // ""')
9
+
10
+ # Block Write/Edit operations on sig/ files
11
+ if [[ "$tool_name" == "Write" || "$tool_name" == "Edit" ]]; then
12
+ file_path=$(echo "$input" | jq -r '.tool_input.file_path // ""')
13
+
14
+ # Judge the path relative to the project root: only the sig/ there is
15
+ # generated. A sig/ nested elsewhere is hand-written and stays editable.
16
+ project_root="${CLAUDE_PROJECT_DIR:-$PWD}"
17
+ rel_path="${file_path#"${project_root}/"}"
18
+
19
+ if [[ "$rel_path" == sig/gems/* ]]; then
20
+ exit 0
21
+ fi
22
+
23
+ if [[ "$rel_path" == sig/* ]]; then
24
+ echo "❌ ERROR: Direct editing of generated sig/ files is not allowed." >&2
25
+ echo "📝 This repository's own types are generated: fix the inline RBS comments in the .rb file." >&2
26
+ echo "💡 Hand-written files are allowed only under sig/gems/ (stubs for third-party gems)." >&2
27
+ exit 2
28
+ fi
29
+ fi
30
+
31
+ # Block manual rbs-inline execution
32
+ if [[ "$tool_name" == "Bash" ]]; then
33
+ command=$(echo "$input" | jq -r '.tool_input.command // ""')
34
+
35
+ # Match rbs-inline only at a command position, not as an argument.
36
+ rbs_inline_re=$'(^|[;&|(\n])[[:space:]]*(bundle[[:space:]]+exec[[:space:]]+)?([^[:space:]]*/)?rbs-inline([[:space:]]|[;&|)]|$)'
37
+
38
+ if [[ "$command" =~ $rbs_inline_re ]]; then
39
+ echo "❌ ERROR: Manual rbs-inline execution is not allowed." >&2
40
+ echo "🔄 Type definitions are auto-generated by hooks." >&2
41
+ exit 2
42
+ fi
43
+ fi
44
+
45
+ exit 0
@@ -0,0 +1,95 @@
1
+ #!/bin/bash
2
+
3
+ # Hook input is JSON from stdin
4
+ input=$(cat)
5
+ tool_name=$(echo "$input" | jq -r '.tool_name')
6
+
7
+ cd "$CLAUDE_PROJECT_DIR" || exit 1
8
+
9
+ if [ "${CLAUDE_CODE_REMOTE:-}" = "true" ]; then
10
+ eval "$(rbenv init - bash)"
11
+ fi
12
+
13
+ # Handle Edit or Write tools
14
+ if [[ "$tool_name" == "Edit" || "$tool_name" == "Write" ]]; then
15
+ file_path=$(echo "$input" | jq -r '.tool_input.file_path // ""')
16
+
17
+ if [[ ! "$file_path" =~ \.rb$ ]]; then
18
+ exit 0
19
+ fi
20
+
21
+ if [[ ! "$file_path" =~ /lib/ ]]; then
22
+ exit 0
23
+ fi
24
+
25
+ echo "Running rbs-inline for $file_path..." >&2
26
+
27
+ if ! bundle exec rbs-inline --opt-out --output=sig/ "$file_path" >&2; then
28
+ echo "Warning: RBS generation failed for $file_path" >&2
29
+ exit 0
30
+ fi
31
+
32
+ echo "RBS generation completed." >&2
33
+ exit 0
34
+ fi
35
+
36
+ # Handle Bash tool for mv command
37
+ if [[ "$tool_name" == "Bash" ]]; then
38
+ command=$(echo "$input" | jq -r '.tool_input.command // ""')
39
+
40
+ # Check if this is a mv command
41
+ if [[ ! "$command" =~ ^[[:space:]]*(mv|git\ mv)[[:space:]] ]]; then
42
+ exit 0
43
+ fi
44
+
45
+ # Extract source and destination paths from mv command
46
+ paths=$(echo "$command" | sed -E 's/^[[:space:]]*(git[[:space:]]+)?mv[[:space:]]+//')
47
+
48
+ source_path=$(echo "$paths" | awk '{print $1}')
49
+ dest_path=$(echo "$paths" | awk '{print $2}')
50
+
51
+ # Check if source was a .rb file in lib/
52
+ if [[ ! "$source_path" =~ \.rb$ ]] || [[ ! "$source_path" =~ lib/ ]]; then
53
+ exit 0
54
+ fi
55
+
56
+ echo "Detected mv of Ruby file in lib/: $source_path -> $dest_path" >&2
57
+
58
+ # Calculate the corresponding .rbs file path for the source
59
+ source_rbs=$(echo "$source_path" | sed -E 's|^(.*/)?lib/|sig/|; s|\.rb$|.rbs|')
60
+
61
+ # Remove the old .rbs file if it exists
62
+ if [[ -f "$source_rbs" ]]; then
63
+ echo "Removing old RBS file: $source_rbs" >&2
64
+ rm -f "$source_rbs"
65
+ fi
66
+
67
+ # Determine the new .rb file path
68
+ if [[ -d "$dest_path" ]]; then
69
+ dest_file="$dest_path/$(basename "$source_path")"
70
+ else
71
+ dest_file="$dest_path"
72
+ fi
73
+
74
+ # Check if the destination is in lib/
75
+ if [[ ! "$dest_file" =~ lib/ ]]; then
76
+ echo "Destination is not in lib/, skipping RBS generation" >&2
77
+ exit 0
78
+ fi
79
+
80
+ # Generate RBS for the new file
81
+ if [[ -f "$dest_file" ]]; then
82
+ echo "Running rbs-inline for $dest_file..." >&2
83
+
84
+ if ! bundle exec rbs-inline --opt-out --output=sig/ "$dest_file" >&2; then
85
+ echo "Warning: RBS generation failed for $dest_file" >&2
86
+ exit 0
87
+ fi
88
+
89
+ echo "RBS generation completed." >&2
90
+ fi
91
+
92
+ exit 0
93
+ fi
94
+
95
+ exit 0
@@ -0,0 +1,93 @@
1
+ #!/bin/bash
2
+ #
3
+ # PreToolUse hook: review code before `git commit`.
4
+ #
5
+ # Fires before a Bash `git commit` command and blocks the first commit attempt
6
+ # for a given change-set, asking Claude to review the code before committing.
7
+ # The review uses the `self-review` skill when available, and falls back to the
8
+ # bundled `code-review` skill otherwise — so the hook works even in projects
9
+ # that don't ship the custom self-review skill.
10
+ #
11
+ # A per-change-set marker (keyed by a hash of the diff, stored under .git/)
12
+ # prevents an infinite block loop: once a change-set has been surfaced for
13
+ # review, the matching commit is allowed through. If the review leads to fixes,
14
+ # the diff changes, so the new state is reviewed once more before it commits.
15
+ #
16
+
17
+ set -euo pipefail
18
+
19
+ # Read JSON input from stdin
20
+ input=$(cat)
21
+
22
+ tool_name=$(echo "$input" | jq -r '.tool_name // empty')
23
+ command=$(echo "$input" | jq -r '.tool_input.command // empty')
24
+
25
+ # Only gate the Bash tool running a git commit.
26
+ if [[ "$tool_name" != "Bash" ]]; then
27
+ exit 0
28
+ fi
29
+ # Match `git commit`, or `git -C <path> commit`.
30
+ commit_re='git[[:space:]]+(-C[[:space:]]+[^[:space:]]+[[:space:]]+)?commit'
31
+ if [[ ! "$command" =~ $commit_re ]]; then
32
+ exit 0
33
+ fi
34
+
35
+ # If the command targets a specific repo via `git -C <path>`, operate there too.
36
+ work_dir="."
37
+ if [[ "$command" =~ git[[:space:]]+-C[[:space:]]+([^[:space:]]+) ]]; then
38
+ work_dir="${BASH_REMATCH[1]}"
39
+ fi
40
+
41
+ # Not a git repo → nothing to do.
42
+ git_dir=$(git -C "$work_dir" rev-parse --absolute-git-dir 2>/dev/null || true)
43
+ if [[ -z "$git_dir" ]]; then
44
+ exit 0
45
+ fi
46
+
47
+ # Hash what will be committed. `git status --porcelain` is included so a commit
48
+ # that only adds untracked files isn't mistaken for empty; `git diff HEAD` adds
49
+ # tracked content. On the first commit there is no HEAD, so use the working state.
50
+ if git -C "$work_dir" rev-parse --verify HEAD >/dev/null 2>&1; then
51
+ changeset=$(git -C "$work_dir" status --porcelain; git -C "$work_dir" diff HEAD)
52
+ else
53
+ changeset=$(git -C "$work_dir" status --porcelain; git -C "$work_dir" diff; git -C "$work_dir" diff --cached)
54
+ fi
55
+
56
+ # Nothing to review (e.g. a message-only `--amend`) → let it proceed.
57
+ if [[ -z "$changeset" ]]; then
58
+ exit 0
59
+ fi
60
+
61
+ hash=$(printf '%s' "$changeset" | git hash-object --stdin)
62
+ state_file="$git_dir/self-review-reviewed"
63
+
64
+ # Already surfaced for review → allow the commit.
65
+ if [[ -f "$state_file" ]] && grep -qxF "$hash" "$state_file"; then
66
+ exit 0
67
+ fi
68
+
69
+ # Record this change-set and block once to force a review first.
70
+ echo "$hash" >> "$state_file"
71
+
72
+ review_prompt='SELF-REVIEW REQUIRED before committing. Review the changes that are
73
+ about to be committed BEFORE running git commit again:
74
+
75
+ - If the `self-review` skill is available, invoke it (Skill tool, skill "self-review").
76
+ - Otherwise, run the bundled `/code-review` skill on the working diff.
77
+
78
+ Judge each finding the review returns rather than fixing it on sight. Weigh what the review
79
+ attached to it — how it graded the point, the basis it gave — and decide whether acting on it
80
+ is worth it. Where you skip a finding, say so; do not drop it silently. Where the choice needs
81
+ a requirement or an intent you do not have, leave it to the user. Once every fix you judged
82
+ necessary is in, review again; when nothing you judged worth fixing is left, run the same git
83
+ commit command again to proceed — it will be allowed through.'
84
+
85
+ jq -n --arg reason "$review_prompt" '{
86
+ "hookSpecificOutput": {
87
+ "hookEventName": "PreToolUse",
88
+ "permissionDecision": "deny",
89
+ "permissionDecisionReason": $reason
90
+ }
91
+ }'
92
+
93
+ exit 0
@@ -0,0 +1,58 @@
1
+ {
2
+ "hooks": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "Edit|Write|Bash",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/protect-sig-files.sh",
10
+ "timeout": 5000
11
+ }
12
+ ]
13
+ },
14
+ {
15
+ "matcher": "Bash",
16
+ "hooks": [
17
+ {
18
+ "type": "command",
19
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/pre-commit-check.sh",
20
+ "timeout": 300000
21
+ }
22
+ ]
23
+ },
24
+ {
25
+ "matcher": "Bash",
26
+ "hooks": [
27
+ {
28
+ "type": "command",
29
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/self-review.sh",
30
+ "timeout": 10000
31
+ }
32
+ ]
33
+ }
34
+ ],
35
+ "SessionStart": [
36
+ {
37
+ "hooks": [
38
+ {
39
+ "type": "command",
40
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/claude-code-web-session-start.sh"
41
+ }
42
+ ]
43
+ }
44
+ ],
45
+ "PostToolUse": [
46
+ {
47
+ "matcher": "Edit|Write|Bash",
48
+ "hooks": [
49
+ {
50
+ "type": "command",
51
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/rbs-inline.sh",
52
+ "timeout": 60000
53
+ }
54
+ ]
55
+ }
56
+ ]
57
+ }
58
+ }
data/.rubocop.yml CHANGED
@@ -1,27 +1,84 @@
1
+ # NOTE: Rules are sorted in ASCII order.
2
+
1
3
  AllCops:
2
- TargetRubyVersion: 2.7
4
+ NewCops: enable
5
+ TargetRubyVersion: 3.3
6
+
7
+ plugins:
8
+ - rubocop-instance_variable_access
9
+ - rubocop-numbered-params
10
+ - rubocop-rake
11
+ - rubocop-rbs_inline
12
+ - rubocop-rspec
13
+ - rubocop-rspec-unused-let
3
14
 
15
+ # Layout
4
16
  Layout/LeadingCommentSpace:
5
17
  AllowRBSInlineAnnotation: true
6
18
  AllowSteepAnnotation: true
7
19
 
20
+ Layout/LineLength:
21
+ Max: 120
22
+
23
+ # Metrics
24
+ Metrics/AbcSize:
25
+ Max: 20
26
+
8
27
  Metrics/BlockLength:
9
28
  Exclude:
10
29
  - "rbs_activemodel.gemspec"
11
30
  - "spec/**/*.rb"
12
31
 
13
32
  Metrics/ClassLength:
14
- Max: 150
33
+ Max: 200
15
34
 
16
35
  Metrics/CyclomaticComplexity:
17
36
  Max: 10
18
37
 
19
38
  Metrics/MethodLength:
20
- Max: 20
39
+ Max: 30
40
+
41
+ # RSpec
42
+ RSpec/ExampleLength:
43
+ Enabled: false
44
+
45
+ RSpec/MultipleExpectations:
46
+ Enabled: false
47
+
48
+ RSpec/MultipleMemoizedHelpers:
49
+ Max: 10
50
+
51
+ RSpec/NamedSubject:
52
+ Enabled: false
53
+
54
+ RSpec/NestedGroups:
55
+ Max: 5
56
+
57
+ # Style
58
+ Style/AccessorGrouping:
59
+ Enabled: false
60
+
61
+ Style/CommentedKeyword:
62
+ Enabled: false
21
63
 
22
64
  Style/Documentation:
23
65
  Enabled: false
24
66
 
67
+ Style/HashSyntax:
68
+ EnforcedShorthandSyntax: always
69
+
70
+ Style/RbsInline:
71
+ Mode: opt_out
72
+
73
+ Style/RbsInline/MissingTypeAnnotation:
74
+ EnforcedStyle: doc_style_and_return_annotation
75
+
76
+ Style/RbsInline/RedundantTypeAnnotation:
77
+ EnforcedStyle: doc_style_and_return_annotation
78
+
79
+ Style/RedundantFormat:
80
+ Enabled: false
81
+
25
82
  Style/StringLiterals:
26
83
  EnforcedStyle: double_quotes
27
84
 
@@ -17,7 +17,8 @@
17
17
  "rmtree",
18
18
  "rubygems",
19
19
  "Takeshi",
20
- "tasklib"
20
+ "tasklib",
21
+ "tk0miya"
21
22
  ],
22
23
  "rbs-helper.rbs-inline-on-save": true,
23
24
  "rbs-helper.rbs-inline-signature-directory": "sig/"
data/Rakefile CHANGED
@@ -1,8 +1,43 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
4
5
  require "rubocop/rake_task"
5
6
 
6
7
  RuboCop::RakeTask.new
8
+ RSpec::Core::RakeTask.new(:spec)
7
9
 
8
- task default: :rubocop
10
+ task default: :ci
11
+
12
+ task ci: %i[rubocop spec steep rbs:validate]
13
+
14
+ namespace :rbs do
15
+ # sig/gems holds hand-written types for external gems, so it is never regenerated
16
+ kept = ->(path) { path == "sig/gems" || path.start_with?("sig/gems/") }
17
+
18
+ desc "Install RBS collection"
19
+ task :install do
20
+ sh "bundle exec rbs collection install --frozen"
21
+ end
22
+
23
+ desc "Regenerate all RBS files under sig/ from scratch (run manually after editing lib/)"
24
+ task :regenerate do
25
+ Dir.glob("sig/**/*.rbs").reject(&kept).each { rm _1 }
26
+
27
+ sh "bundle exec rbs-inline --opt-out --output=sig lib"
28
+
29
+ # Drop the directories the deletion above left empty, deepest first
30
+ dirs = Dir.glob("sig/**/*").select { File.directory?(_1) }
31
+ dirs.reject(&kept).sort.reverse_each { rmdir _1 if Dir.empty?(_1) }
32
+ end
33
+
34
+ desc "Validate RBS files"
35
+ task validate: "rbs:install" do
36
+ sh "bundle exec rbs -Isig validate"
37
+ end
38
+ end
39
+
40
+ desc "Run steep type check"
41
+ task steep: "rbs:install" do
42
+ sh "bundle exec steep check"
43
+ end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_model"
4
3
  require "active_record"
4
+ require "active_support/core_ext/integer" # Load integer extensions to avoid AM's error
5
5
  require "bigdecimal"
6
6
  require "date"
7
7
  require "rbs"
@@ -71,7 +71,7 @@ module RbsActivemodel
71
71
  def format(rbs) #: String
72
72
  parsed = RBS::Parser.parse_signature(rbs)
73
73
  StringIO.new.tap do |out|
74
- RBS::Writer.new(out: out).write(parsed[1] + parsed[2])
74
+ RBS::Writer.new(out:).write(parsed[1] + parsed[2])
75
75
  end.string
76
76
  end
77
77
 
@@ -102,7 +102,7 @@ module RbsActivemodel
102
102
  methods = klass.instance_methods.grep(/^authenticate_/)
103
103
  @secure_password ||= methods.filter_map do |method_name|
104
104
  attribute = method_name.to_s.split("_").last
105
- next unless klass.instance_methods.include?(:"#{attribute}_confirmation")
105
+ next unless klass.method_defined?(:"#{attribute}_confirmation")
106
106
 
107
107
  <<~RBS
108
108
  attr_reader #{attribute}: String?
@@ -155,10 +155,9 @@ module RbsActivemodel
155
155
 
156
156
  # @rbs name: String
157
157
  def having_default?(name) #: bool
158
- klass.instance_eval { pending_attribute_modifications }
159
- .find do |mod|
160
- mod.is_a?(::ActiveModel::AttributeRegistration::ClassMethods::PendingDefault) && mod.name == name
161
- end
158
+ # @type var model: untyped
159
+ model = klass
160
+ model._default_attributes[name].is_a?(::ActiveModel::Attribute::UserProvidedDefault)
162
161
  end
163
162
 
164
163
  # @rbs name: String
@@ -10,7 +10,7 @@ module RbsActivemodel
10
10
 
11
11
  # @rbs name: Symbol
12
12
  # @rbs &block: ?(self) -> void
13
- def initialize(name = :'rbs:activemodel', &block) #: void
13
+ def initialize(name = :"rbs:activemodel", &block) #: void
14
14
  super()
15
15
 
16
16
  @name = name
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RbsActivemodel
4
- VERSION = "1.4.0" #: String
4
+ VERSION = "1.4.1" #: String
5
5
  end
@@ -2,43 +2,43 @@
2
2
  path: ".gem_rbs_collection"
3
3
  gems:
4
4
  - name: actionpack
5
- version: '7.2'
5
+ version: '8.1'
6
6
  source:
7
7
  type: git
8
8
  name: ruby/gem_rbs_collection
9
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
9
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
10
10
  remote: https://github.com/ruby/gem_rbs_collection.git
11
11
  repo_dir: gems
12
12
  - name: actionview
13
- version: '6.0'
13
+ version: '8.1'
14
14
  source:
15
15
  type: git
16
16
  name: ruby/gem_rbs_collection
17
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
17
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
18
18
  remote: https://github.com/ruby/gem_rbs_collection.git
19
19
  repo_dir: gems
20
20
  - name: activemodel
21
- version: '7.1'
21
+ version: '8.1'
22
22
  source:
23
23
  type: git
24
24
  name: ruby/gem_rbs_collection
25
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
25
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
26
26
  remote: https://github.com/ruby/gem_rbs_collection.git
27
27
  repo_dir: gems
28
28
  - name: activerecord
29
- version: '7.2'
29
+ version: '8.1'
30
30
  source:
31
31
  type: git
32
32
  name: ruby/gem_rbs_collection
33
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
33
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
34
34
  remote: https://github.com/ruby/gem_rbs_collection.git
35
35
  repo_dir: gems
36
36
  - name: activesupport
37
- version: '7.0'
37
+ version: '8.1'
38
38
  source:
39
39
  type: git
40
40
  name: ruby/gem_rbs_collection
41
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
41
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
42
42
  remote: https://github.com/ruby/gem_rbs_collection.git
43
43
  repo_dir: gems
44
44
  - name: ast
@@ -46,35 +46,39 @@ gems:
46
46
  source:
47
47
  type: git
48
48
  name: ruby/gem_rbs_collection
49
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
49
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
50
50
  remote: https://github.com/ruby/gem_rbs_collection.git
51
51
  repo_dir: gems
52
52
  - name: base64
53
- version: '0'
53
+ version: 0.3.0
54
54
  source:
55
- type: stdlib
55
+ type: rubygems
56
56
  - name: bcrypt
57
57
  version: '3.1'
58
58
  source:
59
59
  type: git
60
60
  name: ruby/gem_rbs_collection
61
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
61
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
62
62
  remote: https://github.com/ruby/gem_rbs_collection.git
63
63
  repo_dir: gems
64
64
  - name: bigdecimal
65
- version: '0'
65
+ version: 4.1.3
66
66
  source:
67
- type: stdlib
67
+ type: rubygems
68
68
  - name: cgi
69
- version: '0'
69
+ version: '0.5'
70
70
  source:
71
- type: stdlib
71
+ type: git
72
+ name: ruby/gem_rbs_collection
73
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
74
+ remote: https://github.com/ruby/gem_rbs_collection.git
75
+ repo_dir: gems
72
76
  - name: concurrent-ruby
73
77
  version: '1.1'
74
78
  source:
75
79
  type: git
76
80
  name: ruby/gem_rbs_collection
77
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
81
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
78
82
  remote: https://github.com/ruby/gem_rbs_collection.git
79
83
  repo_dir: gems
80
84
  - name: connection_pool
@@ -82,7 +86,7 @@ gems:
82
86
  source:
83
87
  type: git
84
88
  name: ruby/gem_rbs_collection
85
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
89
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
86
90
  remote: https://github.com/ruby/gem_rbs_collection.git
87
91
  repo_dir: gems
88
92
  - name: date
@@ -93,6 +97,10 @@ gems:
93
97
  version: '0'
94
98
  source:
95
99
  type: stdlib
100
+ - name: did_you_mean
101
+ version: '0'
102
+ source:
103
+ type: stdlib
96
104
  - name: digest
97
105
  version: '0'
98
106
  source:
@@ -110,7 +118,7 @@ gems:
110
118
  source:
111
119
  type: git
112
120
  name: ruby/gem_rbs_collection
113
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
121
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
114
122
  remote: https://github.com/ruby/gem_rbs_collection.git
115
123
  repo_dir: gems
116
124
  - name: io-console
@@ -121,28 +129,44 @@ gems:
121
129
  version: '0'
122
130
  source:
123
131
  type: stdlib
132
+ - name: language_server-protocol
133
+ version: 3.17.0.6
134
+ source:
135
+ type: rubygems
136
+ - name: lint_roller
137
+ version: '1.1'
138
+ source:
139
+ type: git
140
+ name: ruby/gem_rbs_collection
141
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
142
+ remote: https://github.com/ruby/gem_rbs_collection.git
143
+ repo_dir: gems
124
144
  - name: logger
125
- version: '0'
145
+ version: '1.7'
126
146
  source:
127
- type: stdlib
147
+ type: git
148
+ name: ruby/gem_rbs_collection
149
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
150
+ remote: https://github.com/ruby/gem_rbs_collection.git
151
+ repo_dir: gems
128
152
  - name: minitest
129
- version: '0'
153
+ version: '5.25'
130
154
  source:
131
- type: stdlib
155
+ type: git
156
+ name: ruby/gem_rbs_collection
157
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
158
+ remote: https://github.com/ruby/gem_rbs_collection.git
159
+ repo_dir: gems
132
160
  - name: monitor
133
161
  version: '0'
134
162
  source:
135
163
  type: stdlib
136
- - name: mutex_m
137
- version: '0'
138
- source:
139
- type: stdlib
140
164
  - name: nokogiri
141
165
  version: '1.11'
142
166
  source:
143
167
  type: git
144
168
  name: ruby/gem_rbs_collection
145
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
169
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
146
170
  remote: https://github.com/ruby/gem_rbs_collection.git
147
171
  repo_dir: gems
148
172
  - name: openssl
@@ -158,7 +182,7 @@ gems:
158
182
  source:
159
183
  type: git
160
184
  name: ruby/gem_rbs_collection
161
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
185
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
162
186
  remote: https://github.com/ruby/gem_rbs_collection.git
163
187
  repo_dir: gems
164
188
  - name: parser
@@ -166,19 +190,39 @@ gems:
166
190
  source:
167
191
  type: git
168
192
  name: ruby/gem_rbs_collection
169
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
193
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
170
194
  remote: https://github.com/ruby/gem_rbs_collection.git
171
195
  repo_dir: gems
172
196
  - name: pathname
173
197
  version: '0'
174
198
  source:
175
199
  type: stdlib
200
+ - name: pp
201
+ version: '0'
202
+ source:
203
+ type: stdlib
204
+ - name: prettyprint
205
+ version: '0'
206
+ source:
207
+ type: stdlib
208
+ - name: prism
209
+ version: 1.9.0
210
+ source:
211
+ type: rubygems
212
+ - name: racc
213
+ version: '1.8'
214
+ source:
215
+ type: git
216
+ name: ruby/gem_rbs_collection
217
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
218
+ remote: https://github.com/ruby/gem_rbs_collection.git
219
+ repo_dir: gems
176
220
  - name: rack
177
221
  version: '2.2'
178
222
  source:
179
223
  type: git
180
224
  name: ruby/gem_rbs_collection
181
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
225
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
182
226
  remote: https://github.com/ruby/gem_rbs_collection.git
183
227
  repo_dir: gems
184
228
  - name: rails-dom-testing
@@ -186,7 +230,7 @@ gems:
186
230
  source:
187
231
  type: git
188
232
  name: ruby/gem_rbs_collection
189
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
233
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
190
234
  remote: https://github.com/ruby/gem_rbs_collection.git
191
235
  repo_dir: gems
192
236
  - name: rails-html-sanitizer
@@ -194,15 +238,15 @@ gems:
194
238
  source:
195
239
  type: git
196
240
  name: ruby/gem_rbs_collection
197
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
241
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
198
242
  remote: https://github.com/ruby/gem_rbs_collection.git
199
243
  repo_dir: gems
200
244
  - name: railties
201
- version: '6.0'
245
+ version: '8.1'
202
246
  source:
203
247
  type: git
204
248
  name: ruby/gem_rbs_collection
205
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
249
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
206
250
  remote: https://github.com/ruby/gem_rbs_collection.git
207
251
  repo_dir: gems
208
252
  - name: rainbow
@@ -210,7 +254,7 @@ gems:
210
254
  source:
211
255
  type: git
212
256
  name: ruby/gem_rbs_collection
213
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
257
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
214
258
  remote: https://github.com/ruby/gem_rbs_collection.git
215
259
  repo_dir: gems
216
260
  - name: rake
@@ -218,11 +262,15 @@ gems:
218
262
  source:
219
263
  type: git
220
264
  name: ruby/gem_rbs_collection
221
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
265
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
222
266
  remote: https://github.com/ruby/gem_rbs_collection.git
223
267
  repo_dir: gems
268
+ - name: random-formatter
269
+ version: '0'
270
+ source:
271
+ type: stdlib
224
272
  - name: rbs
225
- version: 3.8.1
273
+ version: 4.2.0
226
274
  source:
227
275
  type: rubygems
228
276
  - name: rdoc
@@ -234,23 +282,27 @@ gems:
234
282
  source:
235
283
  type: git
236
284
  name: ruby/gem_rbs_collection
237
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
285
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
238
286
  remote: https://github.com/ruby/gem_rbs_collection.git
239
287
  repo_dir: gems
288
+ - name: ripper
289
+ version: '0'
290
+ source:
291
+ type: stdlib
240
292
  - name: rubocop
241
293
  version: '1.57'
242
294
  source:
243
295
  type: git
244
296
  name: ruby/gem_rbs_collection
245
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
297
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
246
298
  remote: https://github.com/ruby/gem_rbs_collection.git
247
299
  repo_dir: gems
248
300
  - name: rubocop-ast
249
- version: '1.30'
301
+ version: '1.46'
250
302
  source:
251
303
  type: git
252
304
  name: ruby/gem_rbs_collection
253
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
305
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
254
306
  remote: https://github.com/ruby/gem_rbs_collection.git
255
307
  repo_dir: gems
256
308
  - name: securerandom
@@ -270,13 +322,17 @@ gems:
270
322
  source:
271
323
  type: git
272
324
  name: ruby/gem_rbs_collection
273
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
325
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
274
326
  remote: https://github.com/ruby/gem_rbs_collection.git
275
327
  repo_dir: gems
276
328
  - name: stringio
277
329
  version: '0'
278
330
  source:
279
331
  type: stdlib
332
+ - name: strscan
333
+ version: '0'
334
+ source:
335
+ type: stdlib
280
336
  - name: tempfile
281
337
  version: '0'
282
338
  source:
@@ -286,7 +342,7 @@ gems:
286
342
  source:
287
343
  type: git
288
344
  name: ruby/gem_rbs_collection
289
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
345
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
290
346
  remote: https://github.com/ruby/gem_rbs_collection.git
291
347
  repo_dir: gems
292
348
  - name: time
@@ -297,6 +353,10 @@ gems:
297
353
  version: '0'
298
354
  source:
299
355
  type: stdlib
356
+ - name: tmpdir
357
+ version: '0'
358
+ source:
359
+ type: stdlib
300
360
  - name: tsort
301
361
  version: '0'
302
362
  source:
@@ -306,11 +366,19 @@ gems:
306
366
  source:
307
367
  type: git
308
368
  name: ruby/gem_rbs_collection
309
- revision: 7651e7b92c15bd5b4bc11fd3dd455be0ea571fd0
369
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
310
370
  remote: https://github.com/ruby/gem_rbs_collection.git
311
371
  repo_dir: gems
312
372
  - name: uri
313
373
  version: '0'
314
374
  source:
315
375
  type: stdlib
376
+ - name: zeitwerk
377
+ version: '2.8'
378
+ source:
379
+ type: git
380
+ name: ruby/gem_rbs_collection
381
+ revision: ddaa559df3fbd84ca630e937e2eb59b3e1b62e3b
382
+ remote: https://github.com/ruby/gem_rbs_collection.git
383
+ repo_dir: gems
316
384
  gemfile_lock_path: Gemfile.lock
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbs_activemodel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takeshi KOMIYA
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-01-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activemodel
@@ -66,20 +65,6 @@ dependencies:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
67
  version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: sqlite3
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
68
  description: A RBS files generator for activemodel gem
84
69
  email:
85
70
  - i.tkomiya@gmail.com
@@ -87,6 +72,12 @@ executables: []
87
72
  extensions: []
88
73
  extra_rdoc_files: []
89
74
  files:
75
+ - ".claude/hooks/claude-code-web-session-start.sh"
76
+ - ".claude/hooks/pre-commit-check.sh"
77
+ - ".claude/hooks/protect-sig-files.sh"
78
+ - ".claude/hooks/rbs-inline.sh"
79
+ - ".claude/hooks/self-review.sh"
80
+ - ".claude/settings.json"
90
81
  - ".rubocop.yml"
91
82
  - ".vscode/extensions.json"
92
83
  - ".vscode/settings.json"
@@ -114,7 +105,7 @@ metadata:
114
105
  homepage_uri: https://github.com/tk0miya/rbs_activemodel
115
106
  source_code_uri: https://github.com/tk0miya/rbs_activemodel
116
107
  changelog_uri: https://github.com/tk0miya/rbs_activemodel
117
- post_install_message:
108
+ rubygems_mfa_required: 'true'
118
109
  rdoc_options: []
119
110
  require_paths:
120
111
  - lib
@@ -122,15 +113,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
122
113
  requirements:
123
114
  - - ">="
124
115
  - !ruby/object:Gem::Version
125
- version: 2.7.0
116
+ version: 3.3.0
126
117
  required_rubygems_version: !ruby/object:Gem::Requirement
127
118
  requirements:
128
119
  - - ">="
129
120
  - !ruby/object:Gem::Version
130
121
  version: '0'
131
122
  requirements: []
132
- rubygems_version: 3.5.22
133
- signing_key:
123
+ rubygems_version: 4.0.20
134
124
  specification_version: 4
135
125
  summary: A RBS files generator for activemodel gem
136
126
  test_files: []