From ff5e5aa23f23be1aeffc67413c816ec86a96d86b Mon Sep 17 00:00:00 2001 From: "hyunghwan.chung" Date: Wed, 9 May 2018 16:43:58 +0000 Subject: [PATCH] added just a few lines of code --- moo/kernel/Collect.moo | 23 +++++++++++++++++++++++ moo/kernel/Http.moo | 13 ++++++++++--- 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/moo/kernel/Collect.moo b/moo/kernel/Collect.moo index 1be595f..e454de3 100644 --- a/moo/kernel/Collect.moo +++ b/moo/kernel/Collect.moo @@ -37,6 +37,29 @@ class Collection(Object) self do: [ :el | if (block value: el) { ^el } ]. ^exception_block value. } + +(* ------------------- TODO ------------------------------- + method add: object + { + self subclassResponsibility: #add:. + } + + method select: condition_block + { + | coll | + coll := self class new: self basicSize. + self do: [ :el | if (condition_block value: el) { coll add: el } ]. + ^coll + } + + method reject: condition_block + { + | coll | + coll := self class new: self basicSize. + self do: [ :el | if (condition_block value: el) { } else { coll add: el } ]. + ^coll + } +*) } ## ------------------------------------------------------------------------------- diff --git a/moo/kernel/Http.moo b/moo/kernel/Http.moo index b337720..9018973 100644 --- a/moo/kernel/Http.moo +++ b/moo/kernel/Http.moo @@ -1,9 +1,16 @@ ###include 'Moo.moo'. #include 'Socket.moo'. - class HttpServerSocket(ServerSocket) { + method(#class) initialize + { + self onEvent: #accepted do: [ + + ]. + + ###self addEventListener: self. + } } class HttpServer(Object) @@ -22,14 +29,14 @@ class HttpServer(Object) if (laddr class == Array) { laddr do: [:addr | - sck := ServerSocket family: (addr family) type: Socket.Type.STREAM. + sck := HttpServerSocket family: (addr family) type: Socket.Type.STREAM. self.server_sockets addLast: sck. sck bind: addr. ]. } else { - sck := ServerSocket family: (laddr family) type: Socket.Type.STREAM. + sck := HttpServerSocket family: (laddr family) type: Socket.Type.STREAM. self.server_sockets addLast: sck. sck bind: laddr. }.