Skip to content

Commit

Permalink
add default switch branches
Browse files Browse the repository at this point in the history
  • Loading branch information
goatshriek committed Jul 26, 2024
1 parent 25867f1 commit 771c4eb
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/wrapture/scope.rb
Original file line number Diff line number Diff line change
Expand Up @@ -255,10 +255,12 @@ def overloads?(parent)
# Returns the ClassSpec for the given +type+ in the scope, if one exists.
def type(type)
name = case type
when String
type
when TypeSpec
type.base
when String
type
else
type.to_s
end

@classes.find { |class_spec| class_spec.name == name }
Expand All @@ -267,10 +269,12 @@ def type(type)
# Returns true if there is a class matching the given +type+ in this scope.
def type?(type)
name = case type
when String
type
when TypeSpec
type.base
when String
type
else
type.to_s
end

@classes.any? { |class_spec| class_spec.name == name }
Expand Down

0 comments on commit 771c4eb

Please sign in to comment.