https://github.com/simlegate/kstarv 想法来源于项目中需要读写 Centos 的网卡配置文件
DEVICE=eth0
HWADDR=00:1E:67:24:E8:2D
TYPE=Ethernet
UUID=8dc70db4-9c80-4757-807b-6419d864f74d
ONBOOT=yes
NM_CONTROLLED=no
BOOTPROTO=static
IPADDR=192.168.0.201
NETMASK=255.255.255.0
GATEWAY=192.168.0.1
BORADCAST=192.168.0.255
基本用法:
@kv = Kstarv.from(/path/to/config)
@kv.ipaddr # => 127.0.0.1
@kv.write