1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/drb/acl.rb: split executable code into sample directory.

* sample/drb/acl.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2014-08-21 04:23:43 +00:00
parent 9cb4054cde
commit bff692b94d
3 changed files with 20 additions and 18 deletions

View file

@ -1,3 +1,8 @@
Thu Aug 21 13:21:45 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* lib/drb/acl.rb: split executable code into sample directory.
* sample/drb/acl.rb: ditto.
Thu Aug 21 12:55:35 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com>
* .gitignore: ignored temporary file for Changelog.

View file

@ -230,21 +230,3 @@ class ACL
end
end
if __FILE__ == $0
# example
list = %w(deny all
allow 192.168.1.1
allow ::ffff:192.168.1.2
allow 192.168.1.3
)
addr = ["AF_INET", 10, "lc630", "192.168.1.3"]
acl = ACL.new
p acl.allow_addr?(addr)
acl = ACL.new(list, ACL::DENY_ALLOW)
p acl.allow_addr?(addr)
end

15
sample/drb/acl.rb Normal file
View file

@ -0,0 +1,15 @@
require 'drb/acl'
list = %w(deny all
allow 192.168.1.1
allow ::ffff:192.168.1.2
allow 192.168.1.3
)
addr = ["AF_INET", 10, "lc630", "192.168.1.3"]
acl = ACL.new
p acl.allow_addr?(addr)
acl = ACL.new(list, ACL::DENY_ALLOW)
p acl.allow_addr?(addr)