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
# frozen_string_literal: true
# A class demonstrating attribute declarations.
# A read-only attribute.
#
# @return [String]
attr_reader :readonly_value
# A write-only attribute.
#
# @return [Integer]
attr_writer :writeonly_value
# A read-write attribute.
#
# @return [Boolean]
attr_accessor :readwrite_value
# Multiple attributes on one line (read-only).
#
# @return [Object]
attr_reader :first, :second, :third
# Multiple attributes on one line (read-write).
#
# @return [Object]
attr_accessor :alpha, :beta
# Initializes the attributes.
#
# @param readonly [String] the read-only value
@readonly_value = readonly
@writeonly_value = 0
@readwrite_value = false
@first = @second = @third = nil
@alpha = @beta = nil
end
end