Module: Net::IMAP::Config::AttrAccessors
- Extended by:
- Forwardable
- Included in:
- Net::IMAP::Config
- Defined in:
- lib/net/imap/config/attr_accessors.rb
Overview
NOTE: This module is an internal implementation detail, with no guarantee of backward compatibility.
attr_accessor
values are stored in a struct rather than ivars, making it simpler to ensure that all config objects share a single object shape. This also simplifies iteration over all defined attributes.
Class Method Summary collapse
-
.attr_accessor(name) ⇒ Object
:nodoc: internal API.
-
.struct ⇒ Object
:nodoc: internal API.
Instance Method Summary collapse
-
#freeze ⇒ Object
Freezes the internal attributes struct, in addition to
self
. -
#initialize ⇒ Object
:notnew:.
Class Method Details
.attr_accessor(name) ⇒ Object
:nodoc: internal API
28 29 30 31 |
# File 'lib/net/imap/config/attr_accessors.rb', line 28 def self.attr_accessor(name) # :nodoc: internal API name = name.to_sym def_delegators :data, name, :"#{name}=" end |
.struct ⇒ Object
:nodoc: internal API
38 39 40 41 42 43 |
# File 'lib/net/imap/config/attr_accessors.rb', line 38 def self.struct # :nodoc: internal API unless defined?(self::Struct) const_set :Struct, Struct.new(*attributes) end self::Struct end |
Instance Method Details
#freeze ⇒ Object
Freezes the internal attributes struct, in addition to self
.
51 52 53 54 |
# File 'lib/net/imap/config/attr_accessors.rb', line 51 def freeze data.freeze super end |
#initialize ⇒ Object
:notnew:
45 46 47 48 |
# File 'lib/net/imap/config/attr_accessors.rb', line 45 def initialize # :notnew: super() @data = AttrAccessors.struct.new end |