Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use create_method_from_def to simplify CurrentAttributes compiler #1778

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions lib/tapioca/dsl/compilers/active_support_current_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,13 @@ def instance_methods_of_constant

sig { params(klass: RBI::Scope, method: String, class_method: T::Boolean).void }
def generate_method(klass, method, class_method:)
if method.end_with?("=")
parameter = create_param("value", type: "T.untyped")
klass.create_method(
method,
class_method: class_method,
parameters: [parameter],
return_type: "T.untyped",
)
method_def = if class_method
constant.method(method)
else
klass.create_method(method, class_method: class_method, return_type: "T.untyped")
constant.instance_method(method)
end

create_method_from_def(klass, method_def, class_method: class_method)
end
end
end
Expand Down
Loading