Skip to content

Commit a25cb43

Browse files
committed
Make name optional and tidy up comments.
1 parent 9a68be4 commit a25cb43

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

lib/async/service/loader.rb

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,14 @@ def environment(**initial, &block)
4747
Environment.build(**initial, &block)
4848
end
4949

50-
# Define a host with the specified name.
51-
# Adds `root` and `authority` keys.
50+
# Define a service with the specified name.
51+
# Adds `root` and `name` keys.
5252
# @parameter name [String] The name of the environment, usually a hostname.
53-
def service(name, &block)
54-
@configuration.add(self.environment(name: name, root: @root, &block))
53+
def service(name = nil, **options, &block)
54+
options[:name] = name
55+
options[:root] ||= @root
56+
57+
@configuration.add(self.environment(**options, &block))
5558
end
5659
end
5760
end

0 commit comments

Comments
 (0)