Class: JabberTee::Configuration
- Inherits:
-
Object
- Object
- JabberTee::Configuration
- Defined in:
- lib/jabber-tee/configuration.rb
Constant Summary collapse
- ATTRIBUTES =
['username', 'nick', 'password', 'anonymous', 'sasl', 'digest', 'room', 'to']
Instance Attribute Summary collapse
-
#nick ⇒ Object
readonly
Returns the value of attribute nick.
-
#room ⇒ Object
readonly
Returns the value of attribute room.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
- #anonymous? ⇒ Boolean
- #destination_missing? ⇒ Boolean
- #digest? ⇒ Boolean
- #in_room? ⇒ Boolean
-
#initialize(options = nil) ⇒ Configuration
constructor
A new instance of Configuration.
- #merge(options) ⇒ Object
- #password ⇒ Object
- #sasl? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ Configuration
43 44 45 46 47 |
# File 'lib/jabber-tee/configuration.rb', line 43 def initialize(=nil) if !.nil? merge() end end |
Instance Attribute Details
#nick ⇒ Object (readonly)
Returns the value of attribute nick.
41 42 43 |
# File 'lib/jabber-tee/configuration.rb', line 41 def nick @nick end |
#room ⇒ Object (readonly)
Returns the value of attribute room.
41 42 43 |
# File 'lib/jabber-tee/configuration.rb', line 41 def room @room end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
41 42 43 |
# File 'lib/jabber-tee/configuration.rb', line 41 def to @to end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
41 42 43 |
# File 'lib/jabber-tee/configuration.rb', line 41 def username @username end |
Instance Method Details
#anonymous? ⇒ Boolean
67 68 69 |
# File 'lib/jabber-tee/configuration.rb', line 67 def anonymous? !@anonymous.nil? && username.nil? end |
#destination_missing? ⇒ Boolean
83 84 85 |
# File 'lib/jabber-tee/configuration.rb', line 83 def destination_missing? @room.nil? && @to.nil? end |
#digest? ⇒ Boolean
75 76 77 |
# File 'lib/jabber-tee/configuration.rb', line 75 def digest? !@digest.nil? end |
#in_room? ⇒ Boolean
79 80 81 |
# File 'lib/jabber-tee/configuration.rb', line 79 def in_room? !@room.nil? end |
#merge(options) ⇒ Object
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/jabber-tee/configuration.rb', line 49 def merge() #self if options.nil? ATTRIBUTES.each do |attr| if .has_key?(attr.to_sym) || .has_key?(attr) value = [attr.to_sym] || [attr] instance_variable_set("@#{attr}", value) end end self end |
#password ⇒ Object
60 61 62 63 64 65 |
# File 'lib/jabber-tee/configuration.rb', line 60 def password if @password.nil? @password = ask("#{username}: password: ") {|q| q.echo = false } end @password end |
#sasl? ⇒ Boolean
71 72 73 |
# File 'lib/jabber-tee/configuration.rb', line 71 def sasl? !@sasl.nil? end |
#to_s ⇒ Object
87 88 89 |
# File 'lib/jabber-tee/configuration.rb', line 87 def to_s "<JabberTee::Configuration{:username => '#{username}', :room => '#{room}', :to => '#{to}', :anonymous => #{anonymous?}, :sasl => #{sasl?}}>" end |