Skip to content

Commit

Permalink
Merge pull request #3 from mattlqx/cookbook-metadata
Browse files Browse the repository at this point in the history
fix type conversion issue with multiple keywords
  • Loading branch information
mattlqx authored Mar 21, 2019
2 parents 65a2bb8 + f1eb927 commit 3174744
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To check Chef cookbook version bumps, use the `chef-cookbook-version` hook. Each
To unit test Ruby changes in your repo, use the `rspec` hook. Each path in your repo with a `spec` directory should have a `Gemfile` that includes your desired version of rspec (or a derivative library). It will be installed via Bundler prior to testing. Rspec will only be run against the closest directory in a changed file's path with a spec dir.

- repo: https://github.com/mattlqx/pre-commit-ruby
rev: v1.2.1
rev: v1.2.2
hooks:
- id: rubocop
- id: foodcritic
Expand Down
3 changes: 2 additions & 1 deletion bin/cookbook-wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ def empty?
@data.empty?
end

def method_missing(sym, *args, &_block) # rubocop:disable Metrics/AbcSize, Style/MethodMissingSuper, Style/MissingRespondToMissing, Metrics/LineLength
def method_missing(sym, *args, &_block) # rubocop:disable Metrics/AbcSize, Style/MethodMissingSuper, Style/MissingRespondToMissing, Metrics/LineLength, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
return @data[sym] if args.empty?

if args.length > 1
@data[sym] ||= []
@data[sym] = [@data[sym]] unless @data[sym].is_a?(Array)
@data[sym] << args
elsif @data.key?(sym)
@data[sym] = [@data[sym]] unless @data[sym].is_a?(Array)
Expand Down

0 comments on commit 3174744

Please sign in to comment.