123456789_123456789_123456789_123456789_123456789_

Module: Net::IMAP::Config::AttrTypeCoercion

Do not use. This module is for internal use only.
Relationships & Source Files
Namespace Children
Modules:
Extension / Inclusion / Inheritance Descendants
Included In:
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
Defined in: lib/net/imap/config/attr_type_coercion.rb

Overview

NOTE: This module is an internal implementation detail, with no

guarantee of backward compatibility.

Adds a type keyword parameter to .attr_accessor, to enforce that config attributes have valid types, for example: boolean, numeric, enumeration, non-nullable, etc.

Constant Summary

Class Method Summary

::Net::IMAP::Utils - Extended

implicit_int

Something like this exists in ruby's C API.

shareable

simplecov:disable.

Class Method Details

.attr_accessor(attr, type: nil)

[ GitHub ]

  
# File 'lib/net/imap/config/attr_type_coercion.rb', line 42

def self.attr_accessor(attr, type: nil)
  type = Types[type] or return
  define_method :"#{attr}=" do |val| super type[val] end
  define_method :"#{attr}?" do send attr end if type == Boolean
end

.included(mod) (private)

[ GitHub ]

  
# File 'lib/net/imap/config/attr_type_coercion.rb', line 28

def self.included(mod)
  mod.extend Macros
end