Class: Inspector::Constraints::Empty

Inherits:
Object
  • Object
show all
Includes:
Inspector::Constraint
Defined in:
lib/inspector/constraints/empty.rb

Instance Method Summary collapse

Methods included from Inspector::Constraint

#negate!, #positive?, #validator

Instance Method Details

#inspectObject



16
17
18
# File 'lib/inspector/constraints/empty.rb', line 16

def inspect
  "#<empty>"
end

#to_sObject



12
13
14
# File 'lib/inspector/constraints/empty.rb', line 12

def to_s
  "be_empty"
end

#valid?(actual) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/inspector/constraints/empty.rb', line 6

def valid?(actual)
  actual = actual.to_s unless actual.respond_to?(:empty?)

  actual.empty?
end