Class: EM::FTPD::Configurator
- Inherits:
-
Object
- Object
- EM::FTPD::Configurator
- Defined in:
- lib/em-ftpd/configurator.rb
Instance Method Summary collapse
- #check! ⇒ Object
- #daemonise(val = nil) ⇒ Object
- #driver(klass = nil) ⇒ Object
- #driver_args(*args) ⇒ Object
- #gid ⇒ Object
- #group(val = nil) ⇒ Object
-
#initialize ⇒ Configurator
constructor
A new instance of Configurator.
- #name(val = nil) ⇒ Object
- #pid_file(val = nil) ⇒ Object
- #port(val = nil) ⇒ Object
- #uid ⇒ Object
- #user(val = nil) ⇒ Object
Constructor Details
#initialize ⇒ Configurator
Returns a new instance of Configurator.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/em-ftpd/configurator.rb', line 7 def initialize @user = nil @group = nil @daemonise = false @name = nil @pid_file = nil @port = 21 @driver = nil @driver_args = [] end |
Instance Method Details
#check! ⇒ Object
106 107 108 109 110 |
# File 'lib/em-ftpd/configurator.rb', line 106 def check! if @driver.nil? die("driver MUST be specified in the config file") end end |
#daemonise(val = nil) ⇒ Object
58 59 60 61 62 63 64 |
# File 'lib/em-ftpd/configurator.rb', line 58 def daemonise(val = nil) if val @daemonise = val else @daemonise end end |
#driver(klass = nil) ⇒ Object
66 67 68 69 70 71 72 |
# File 'lib/em-ftpd/configurator.rb', line 66 def driver(klass = nil) if klass @driver = klass else @driver end end |
#driver_args(*args) ⇒ Object
74 75 76 77 78 79 80 |
# File 'lib/em-ftpd/configurator.rb', line 74 def driver_args(*args) if args.empty? @driver_args else @driver_args = args end end |
#gid ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/em-ftpd/configurator.rb', line 46 def gid return nil if @group.nil? begin detail = Etc.getpwnam(@group) return detail.gid rescue $stderr.puts "group must be nil or a real group" if detail.nil? end end |
#group(val = nil) ⇒ Object
38 39 40 41 42 43 44 |
# File 'lib/em-ftpd/configurator.rb', line 38 def group(val = nil) if val @group = val.to_s else @group end end |
#name(val = nil) ⇒ Object
82 83 84 85 86 87 88 |
# File 'lib/em-ftpd/configurator.rb', line 82 def name(val = nil) if val @name = val.to_s else @name end end |
#pid_file(val = nil) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/em-ftpd/configurator.rb', line 90 def pid_file(val = nil) if val @pid_file = val.to_s else @pid_file end end |
#port(val = nil) ⇒ Object
98 99 100 101 102 103 104 |
# File 'lib/em-ftpd/configurator.rb', line 98 def port(val = nil) if val @port = val.to_i else @port end end |
#uid ⇒ Object
27 28 29 30 31 32 33 34 35 36 |
# File 'lib/em-ftpd/configurator.rb', line 27 def uid return nil if @user.nil? begin detail = Etc.getpwnam(@user) return detail.uid rescue $stderr.puts "user must be nil or a real account" if detail.nil? end end |
#user(val = nil) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/em-ftpd/configurator.rb', line 19 def user(val = nil) if val @user = val.to_s else @user end end |