Sha256: 1bc60af7abbfc5485dbfe49fc11174db11aca3070d9091bfacb4004793accc59

Contents?: true

Size: 420 Bytes

Versions: 5

Compression:

Stored size: 420 Bytes

Contents

module Schemacop
  module V3
    class BooleanNode < Node
      def as_json
        process_json([], type: :boolean)
      end

      def allowed_types
        {
          TrueClass  => :boolean,
          FalseClass => :boolean
        }
      end

      def cast(value)
        if value.is_a?(TrueClass) || value.is_a?(FalseClass)
          value
        else
          default
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
schemacop-3.0.7 lib/schemacop/v3/boolean_node.rb
schemacop-3.0.6 lib/schemacop/v3/boolean_node.rb
schemacop-3.0.5 lib/schemacop/v3/boolean_node.rb
schemacop-3.0.4 lib/schemacop/v3/boolean_node.rb
schemacop-3.0.3 lib/schemacop/v3/boolean_node.rb