kontena / k8s-client

Ruby Kubernetes API client
Apache License 2.0
76 stars 26 forks source link

Make Yajl dependency optional #127

Closed kke closed 5 years ago

kke commented 5 years ago

Fixes #126

Adds a pure-ruby variant for parsing streaming responses and a simple interface for adding custom parsing backends. There's a spec suite that tests single document and streaming response parsing for both backends.

To use the faster YAJL backend, use:

# Gemfile
gem 'k8s-client'
gem 'yajl-ruby'

# app.rb
require 'k8s-client'
require 'k8s/json_parser/yajl'

The Util.deep_transform_keys method was added to avoid stringifying hash keys via JSON.parse(JSON.dump(hash)) which while clever and clean, is a bit lazy way to do it.

Paxa commented 4 years ago

Any plans to remove yajl-ruby from gemspec file?

kke commented 4 years ago

In this PR it was moved to being only a development dependency.