Class: Net::IMAP::ConnectionState
- Defined in:
- lib/net/imap/connection_state.rb
Overview
:nodoc:
Constant Summary collapse
- NotAuthenticated =
define(:not_authenticated)
- Authenticated =
define(:authenticated)
- Selected =
define(:selected)
- Logout =
define(:logout)
Class Method Summary collapse
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
- #deconstruct ⇒ Object
- #deconstruct_keys(names) ⇒ Object
- #logout? ⇒ Boolean
- #name ⇒ Object
- #not_authenticated? ⇒ Boolean
- #selected? ⇒ Boolean
- #symbol ⇒ Object (also: #to_sym)
- #to_h(&block) ⇒ Object
Class Method Details
.define(symbol, *attrs) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/net/imap/connection_state.rb', line 6 def self.define(symbol, *attrs) symbol => Symbol state = super(*attrs) state.const_set :NAME, symbol state end |
Instance Method Details
#authenticated? ⇒ Boolean
32 |
# File 'lib/net/imap/connection_state.rb', line 32 def authenticated?; to_sym == :authenticated end |
#deconstruct ⇒ Object
17 |
# File 'lib/net/imap/connection_state.rb', line 17 def deconstruct; [symbol, *super] end |
#deconstruct_keys(names) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/net/imap/connection_state.rb', line 19 def deconstruct_keys(names) hash = super hash[:symbol] = symbol if names.nil? || names.include?(:symbol) hash[:name] = name if names.nil? || names.include?(:name) hash end |
#logout? ⇒ Boolean
34 |
# File 'lib/net/imap/connection_state.rb', line 34 def logout?; to_sym == :logout end |
#name ⇒ Object
14 |
# File 'lib/net/imap/connection_state.rb', line 14 def name; self.class::NAME.name end |
#not_authenticated? ⇒ Boolean
31 |
# File 'lib/net/imap/connection_state.rb', line 31 def not_authenticated?; to_sym == :not_authenticated end |
#selected? ⇒ Boolean
33 |
# File 'lib/net/imap/connection_state.rb', line 33 def selected?; to_sym == :selected end |
#symbol ⇒ Object Also known as: to_sym
13 |
# File 'lib/net/imap/connection_state.rb', line 13 def symbol; self.class::NAME end |
#to_h(&block) ⇒ Object
26 27 28 29 |
# File 'lib/net/imap/connection_state.rb', line 26 def to_h(&block) hash = deconstruct_keys(nil) block ? hash.to_h(&block) : hash end |