diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-05-07 06:57:21 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-05-07 06:57:21 -0700 |
commit | 945684b71f13b7efae8d4d937f57119784536376 (patch) | |
tree | 02a86c98b74a26592f301cc530099bafbd2297e4 | |
parent | 7a66a3a489f55f6ed1e72bc50b78880032d105ad (diff) | |
download | chef-945684b71f13b7efae8d4d937f57119784536376.tar.gz |
Added Unformatter mixin
-rw-r--r-- | lib/chef/mixin/unformatter.rb | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/chef/mixin/unformatter.rb b/lib/chef/mixin/unformatter.rb new file mode 100644 index 0000000000..7882141629 --- /dev/null +++ b/lib/chef/mixin/unformatter.rb @@ -0,0 +1,32 @@ +# +# Author:: Jay Mundrawala (<jdm@chef.io>) +# Copyright:: Copyright (c) 2015 Chef Software +# 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 + module Mixin + module Unformatter + + def write(message) + data = message.match(/(\[.+?\]) ([\w]+):(.*)$/) + self.send(data[2].downcase.to_sym, data[3].strip) + rescue NoMethodError + self.send(:info, message) + end + + end + end +end |