如题,简单举个例子有 json 文件内容为:[ { "kind": "Service", "apiVersion": "v1", "metadata": { "name": "redis-slave", "namespace": "development3", "selfLink": "/api/v1/namespaces/default/services/redis-slave", "uid": "bdb80a8f-db93-11e4-b293-f8b156af4ae1",
"creationTimestamp": "2015-04-05T13:00:31Z", "labels": { "name": "redis", "role": "slave" } }, "spec": { "ports": [ { "name": "", "protocol": "TCP", "port": 6379, "targetPort": "redis-server" } ], "selector": { "name": "redis", "role": "slave" }, "clusterIP": "10.97.0.141", "sessionAffinity": "None" }, "status": {} }, { "kind": "Endpoints", "apiVersion": "v1", "metadata": { "name": "myendpoint", "namespace": "default", "selfLink": "/api/v1/namespaces/default/endpoints/myendpoint", "uid": "59d05b48-dadb-11e5-937e-18037327aaeb", "creationTimestamp": "2016-02-24T09:45:34Z" }, "subsets": [ { "addresses": [ { "ip": "172.17.0.25" } ], "ports": [ { "name": "https", "port": 6443, "protocol": "TCP" } ] } ] } ] ,现要按照变量“kind”将这个文件中的内容划分为多个 hash 串,请问怎么实现?有相应的 gem 包吗?