codoc 0.1.0

Unified documentation parser for Ruby and TypeScript codebases
Documentation
# frozen_string_literal: true

# A simple class for basic parsing tests.
#
# This class demonstrates basic class structure with inheritance.
#
# @example Creating an instance
#   obj = BasicClass.new("test")
#   obj.name #=> "test"
class BasicClass < ParentClass
  # The name of this instance.
  # @return [String]
  attr_reader :name

  # The count value.
  # @return [Integer]
  attr_accessor :count

  # Creates a new instance.
  #
  # @param name [String] the name to use
  # @param count [Integer] the initial count (default: 0)
  def initialize(name, count = 0)
    @name = name
    @count = count
  end

  # Increments the count.
  #
  # @param amount [Integer] the amount to increment by
  # @return [Integer] the new count
  def increment(amount = 1)
    @count += amount
  end

  # A class method for creating instances.
  #
  # @param name [String] the name
  # @return [BasicClass] a new instance
  def self.create(name)
    new(name)
  end

  private

  # A private helper method.
  #
  # @return [void]
  def validate
    raise ArgumentError, "Invalid name" if @name.nil?
  end
end