Skip to content

Commit 3d167d2

Browse files
committed
feat: excludable resources
1 parent 4d5b98f commit 3d167d2

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

lib/anchor/concerns/type_inferable.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,17 @@ def anchor_schema_name(name = nil)
1212
@anchor_schema_name ||= name || anchor_default_schema_name
1313
end
1414

15+
# @param reason [String] Reason to exclude from schema.
16+
# @return [String]
17+
def anchor_exclude_from_schema(reason: nil)
18+
@anchor_exclude_from_schema ||= reason || (_abstract ? "Abstract." : nil)
19+
end
20+
21+
# @return [Boolean] True if should be excluded.
22+
def anchor_excluded_from_schema?
23+
anchor_exclude_from_schema.present?
24+
end
25+
1526
private
1627

1728
# @anchor_method_added_count[attribute] > 1 implies the attribute
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
class CommentableResource < ApplicationResource; end
1+
class CommentableResource < ApplicationResource
2+
anchor_exclude_from_schema reason: :polymorphic
3+
end

0 commit comments

Comments
 (0)