Class: ScriptDangoServer
Instance Method Summary collapse
-
#initialize(config = {}, start_options = {}) ⇒ ScriptDangoServer
constructor
A new instance of ScriptDangoServer.
Constructor Details
#initialize(config = {}, start_options = {}) ⇒ ScriptDangoServer
Returns a new instance of ScriptDangoServer.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/dango/script/dango_server.rb', line 12 def initialize(config = {}, = {}) .each do |k, v| k =~ /\-\-(\w+?):(\w+?)$/ key1 = Regexp.last_match(1) key2 = Regexp.last_match(2) if key1 && key2 config[key1][key2] = v end end # serverファイル名一覧を取得 load_files = [] glob_str = 'dango/server/*.rb' Dir.glob(glob_str) do |srv_file| load_files.push({:file=>srv_file, :mtime=>File.mtime(srv_file)}) end # ファイル名順にソート load_files = load_files.sort_by{|f| f[:file] } load_files.each do |f| load f[:file] end DangoServer.start(config) end |