Module: Catfriend::AccessorsFromHash

Included in:
ImapServer
Defined in:
lib/catfriend/server.rb

Overview

Mixin to provide #configure which allows all instance variables with write accessors declared to be set from a hash.

Instance Method Summary collapse

Instance Method Details

#configure(args) ⇒ Object

Call this to tranfer the hash data to corresponding attributes. Any hash keys that do not have a corresponding write accessor in the class are silently ignored.



18
19
20
21
22
# File 'lib/catfriend/server.rb', line 18

def configure args
  args.each do |opt, val|
    instance_variable_set("@#{opt}", val) if respond_to? "#{opt}="
  end
end