Sha256: 4d1cd82b1f6ec26e14e77458318f94cc45e9302a9bd75fe5964ff3c35d1478a2

Contents?: true

Size: 426 Bytes

Versions: 4

Compression:

Stored size: 426 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  class ConfigLoader
    class BoolSchema < Schema
      class << self
        def validate(node)
          error(node, 'be true or false') if to_ruby(node).nil?
          super
        end

        def to_ruby(node)
          case node.to_ruby
          when true, 'true' then true
          when false, 'false' then false
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
leftovers-0.12.2 lib/leftovers/config_loader/bool_schema.rb
leftovers-0.12.1 lib/leftovers/config_loader/bool_schema.rb
leftovers-0.12.0 lib/leftovers/config_loader/bool_schema.rb
leftovers-0.11.2 lib/leftovers/config_loader/bool_schema.rb