Skip to content

Commit

Permalink
Document the Chef::EncryptedAttribute::Yajl module
Browse files Browse the repository at this point in the history
  • Loading branch information
zuazo committed May 2, 2015
1 parent 8ec7d17 commit 54239a5
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -243,6 +243,7 @@ See [TODO.md](https://github.com/onddo/chef-encrypted-attributes/blob/master/TOD
| **Author:** | [Xabier de Zuazo](https://github.com/zuazo) (<xabier@onddo.com>)
| **Contributor:** | [Josh Kalderimis](https://github.com/joshk)
| **Contributor:** | [@chhsiung](https://github.com/chhsiung)
| **Contributor:** | [Lisa Danz](https://github.com/ldanz)
| **Copyright:** | Copyright (c) 2014-2015 Onddo Labs, SL. (www.onddo.com)
| **License:** | Apache License, Version 2.0

Expand Down
28 changes: 28 additions & 0 deletions lib/chef/encrypted_attribute/yajl.rb
@@ -1,6 +1,34 @@
# encoding: UTF-8
#
# Author:: Lisa Danz (<lisa.danz@opower.com>)
# Author:: Xabier de Zuazo (<xabier@onddo.com>)
# Copyright:: Copyright (c) 2015 Onddo Labs, SL. (www.onddo.com)
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

class Chef
class EncryptedAttribute
# Helper module to abstract the required Yajl (JSON) dependecy.
module Yajl
# Loads the required Yajl JSON library depending on the installed Chef
# version.
#
# * Loads the `yajl` gem in Chef `< 11.13`.
# * Loads the `ffi_yajl` gem in Chef `>= 11.13`.
#
# @return [Class] The correct JSON class to use.
def self.load_requirement(chef_version)
if Gem::Requirement.new('< 11.13').satisfied_by?(
Gem::Version.new(chef_version)
Expand Down

0 comments on commit 54239a5

Please sign in to comment.