1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# 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"
# 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)
@name = name
@count = count
end
# Increments the count.
#
# @param amount [Integer] the amount to increment by
# @return [Integer] the new count
@count += amount
end
# A class method for creating instances.
#
# @param name [String] the name
# @return [BasicClass] a new instance
new(name)
end
private
# A private helper method.
#
# @return [void]
raise ArgumentError, if @name.nil?
end
end