Extend.rb

This content was produced by an LLM and could include errors.

This script demonstrates how extend mixes Module A’s attributes into Module B. This mixing mechanism allows Module B to access and set properties defined in the external module A.

# frozen_string_literal: true
#=> nil

module A
  attr_accessor :abc
end
#=> [:abc, :abc=]

module B
  extend A
end
#=> B

B.abc = 123
#=> 123
B.abc
#=> 123

Ruby 4.0.3