Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Change. Set node name only in ctor. #4

Merged
merged 1 commit into from

1 participant

@moteus
Owner

Remove set_name method from public API.

@moteus moteus Change. Set node name only in ctor.
Remove `set_name` method from public API.
6a7fc78
@moteus moteus merged commit 0df6267 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 22, 2014
  1. @moteus

    Change. Set node name only in ctor.

    moteus authored
    Remove `set_name` method from public API.
This page is out of date. Refresh to see the latest.
Showing with 9 additions and 14 deletions.
  1. +9 −9 src/lyre.lua
  2. +0 −5 src/lyre/impl/node.lua
View
18 src/lyre.lua
@@ -9,11 +9,13 @@
--
---------------------------------------------------------------------
-local function lyre_node_thread(pipe, outbox)
+local function lyre_node_thread(pipe, outbox, name)
local Node = require "lyre.impl.node"
local node = Node.new(pipe, outbox)
+ if name then node:set_name(name) end
+
node:run()
node:destroy()
end
@@ -43,13 +45,17 @@ end
local Node = {} do
Node.__index = Node
-function Node:new(ctx)
+function Node:new(ctx, name)
+ if type(ctx) == "string" then
+ name, ctx = ctx
+ end
+
if not ctx then ctx = zth.context() end
local inbox, endpoind = make_pipe(ctx)
if not inbox then return nil, endpoind end
- local actor = zth.actor(ctx, lyre_node_thread, endpoind)
+ local actor = zth.actor(ctx, lyre_node_thread, endpoind, name)
local ok, err = actor:start()
if not ok then
@@ -106,12 +112,6 @@ function Node:name()
return self._private.name
end
-function Node:set_name(name)
- self._private.name = nil
- self:_send("SET NAME", name)
- return self
-end
-
function Node:set_header(key, value)
self:_send("SET HEADER", key, value)
return self
View
5 src/lyre/impl/node.lua
@@ -38,11 +38,6 @@ local NODE_API do
local API = {}
-API[ "SET NAME" ] = function (self, pipe, name)
- self:set_name(name)
- return true
-end
-
API[ "SET HEADER" ] = function (self, pipe, name, value)
self:set_header(name, value)
return true
Something went wrong with that request. Please try again.