hosts.cr
hosts.cr
hosts for Crystal.
- crystal: 0.20.4
Installation
Add this to your application's shard.yml
:
dependencies:
hosts:
github: maiha/hosts.cr
version: 0.2.0
API
Hosts.new
Hosts#[](key) : Hosts::Host
Hosts#[]?(key) : Hosts::Host?
Hosts#addr?(key) : String?
Hosts#name?(key) : String?
Usage
require "hosts"
hosts = Hosts.new
hosts["192.168.0.1"] # => Hosts::Host
hosts["192.168.0.1"].names # => Set{"host1", "ubuntu"}
hosts["192.168.1.1"]? # => nil
hosts["host1"] # => Hosts::Host
hosts["host1"].addr # => "192.168.0.1"
hosts["host_xxx"]? # => nil
hosts.name?("192.168.0.1") # => "host1"
hosts.name?("192.168.1.1") # => nil
hosts.addr?("host1") # => "192.168.0.1"
hosts.addr?("host_xxx") # => nil
Contributing
- Fork it ( https://github.com/maiha/hosts.cr/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
- maiha maiha - creator, maintainer
Repository
hosts.cr
Owner
Statistic
- 1
- 0
- 0
- 0
- 0
- over 7 years ago
- January 8, 2017
License
MIT License
Links
Synced at
Sat, 04 May 2024 09:24:22 GMT
Languages