Sha256: ec65de011c515349e6ed64f0ad0cf2c1d3c535fd4130951fe79c5733f9bf1632

Contents?: true

Size: 407 Bytes

Versions: 8

Compression:

Stored size: 407 Bytes

Contents

module Compel
  module Validation

    class Is < Condition

      def option_value
        if value_type == Coercion::Hash
          return @option_value.to_hash
        end

        @option_value
      end

      def validate_value
        unless valid?
          "must be #{option_value}"
        end
      end

      private

      def valid?
        value == option_value
      end

    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
compel-0.5.1 lib/compel/validation/conditions/is.rb
compel-0.5.0 lib/compel/validation/conditions/is.rb
compel-0.4.3 lib/compel/validation/conditions/is.rb
compel-0.4.2 lib/compel/validation/conditions/is.rb
compel-0.4.0 lib/compel/validation/conditions/is.rb
compel-0.3.7 lib/compel/validation/conditions/is.rb
compel-0.3.6 lib/compel/validation/conditions/is.rb
compel-0.3.4 lib/compel/validation/conditions/is.rb