Sha256: 5c1ee9e277ed139bb1bcbc93526452a9d9b99418a9f0d4a6df1b62e17b1b72fe
Contents?: true
Size: 719 Bytes
Versions: 1
Compression:
Stored size: 719 Bytes
Contents
module Inspector module Constraint class Violation autoload :List, 'inspector/constraint/violation/list' attr_reader :constraint def initialize(constraint) @constraint = constraint end def positive? @constraint.positive? end def negative? !@constraint.positive? end def to_s expectation = @constraint.positive? ? 'should' : 'should_not' "#{expectation}.#{@constraint}" end def inspect "#<violated %{type} constraint %{constraint}>" % { :type => @constraint.positive? ? 'positive' : 'negative', :constraint => @constraint.inspect } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
object-inspector-0.1.0 | lib/inspector/constraint/violation.rb |