Sha256: 3628a5dfcaee861eed12cac0a96159a176bfada74c1cabcac99dc62002a51a3e

Contents?: true

Size: 814 Bytes

Versions: 5

Compression:

Stored size: 814 Bytes

Contents

require 'whiskey_disk/config/abstract_filter'

class WhiskeyDisk
  class Config
    class NormalizeSshOptionsFilter < AbstractFilter
      def drop_empties(options_list)
        options_list.select {|option| option and option != '' }
      end
      
      def drop_empty_ssh_options_for_domain(domain)
        result = drop_empties([ domain['ssh_options'] ].flatten)
        if result and result != []
          domain.merge('ssh_options' => result)
        else
          domain.reject {|k,v| k == 'ssh_options' }
        end
      end
      
      def normalize_ssh_options(domains_list)
        domains_list.collect { |domain| drop_empty_ssh_options_for_domain(domain) }
      end
      
      def filter(data)
        data.merge('domain' => normalize_ssh_options(data['domain']))
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 3 rubygems

Version Path
ol-whisk_deploy-0.6.25 lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb
ol-whisk_deploy-0.6.26 lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb
whisk_deploy-0.6.26 lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb
whiskey_disk-0.6.24 lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb
whiskey_disk-0.6.23 lib/whiskey_disk/config/filters/normalize_ssh_options_filter.rb