# frozen_string_literal: true module RbsActivesupport class ClassAttribute attr_reader :name #: Symbol attr_reader :options #: Hash[untyped, untyped] # @rbs name: Symbol # @rbs options: Hash[untyped, untyped] def initialize(name, options) #: void @name = name @options = options end def type #: String # @type var trailng_comment: String? trailing_comment = options[:trailing_comment] if trailing_comment&.start_with?("#:") trailing_comment[2..].strip else "untyped" end end def instance_accessor? #: bool options.fetch(:instance_accessor, true) end def instance_reader? #: bool options.fetch(:instance_reader, instance_accessor?) end def instance_writer? #: bool options.fetch(:instance_writer, instance_accessor?) end def instance_predicate? #: bool options.fetch(:instance_predicate, true) end def public? #: bool !private? end def private? #: bool options.fetch(:private, false) end end end