Sha256: b458b10d90bfdfda5cde88576bca97ce76c16f2992d27bd91c6c4cb1ad0d6dcd
Contents?: true
Size: 898 Bytes
Versions: 11
Compression:
Stored size: 898 Bytes
Contents
module Chamber module Filters class BooleanConversionFilter def initialize(options = {}) self.data = options.fetch(:data).dup end def self.execute(options = {}) self.new(options).send(:execute) end protected attr_accessor :data def execute(settings = data) settings.each_pair do |key, value| if value.respond_to? :each_pair execute(value) else break if value.nil? settings[key] = if value.is_a? String case value when 'false', 'f', 'no' false when 'true', 't', 'yes' true else value end else value end end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems