2 # Declares an attribute reader backed by an internally-named instance variable.
3 def attr_internal_reader(*attrs
)
5 module_eval
"def #{attr}() #{attr_internal_ivar_name(attr)} end"
9 # Declares an attribute writer backed by an internally-named instance variable.
10 def attr_internal_writer(*attrs
)
12 module_eval
"def #{attr}=(v) #{attr_internal_ivar_name(attr)} = v end"
16 # Declares an attribute reader and writer backed by an internally-named instance
18 def attr_internal_accessor(*attrs
)
19 attr_internal_reader(*attrs
)
20 attr_internal_writer(*attrs
)
23 alias_method
:attr_internal, :attr_internal_accessor
26 mattr_accessor
:attr_internal_naming_format
27 self.attr_internal_naming_format
= '@_%s'
29 def attr_internal_ivar_name(attr
)
30 attr_internal_naming_format
% attr