Class: Object

Inherits:
BasicObject
Defined in:
lib/fluidity/is.rb,
lib/fluidity/must.rb,
lib/fluidity/will.rb,
lib/fluidity/assert.rb,
lib/fluidity/should.rb

Overview

BasicObject

Instance Method Summary collapse

Instance Method Details

#assert(matcher = nil, *args, &blk) ⇒ Object

Use ‘assert` nomenclature for assertions.

10.assert.kind_of?(Integer)


9
10
11
12
13
14
15
16
17
18
19
# File 'lib/fluidity/assert.rb', line 9

def assert(matcher=nil, *args, &blk)
  if matcher
    if matcher.respond_to?(:=~) # good enough ?
      matcher =~ self
    else
      super(matcher, *args, &blk)
    end
  else
    ::Fluidity::Grammer::Assert.new(self)
  end
end

#is(matcher = nil) ⇒ Object

Use ‘is` nomenclature for assertions.

10.is.kind_of?(Integer)


9
10
11
12
13
14
15
# File 'lib/fluidity/is.rb', line 9

def is(matcher=nil)
  if matcher
    matcher === self
  else
    ::Fluidity::Grammer::Is.new(self)
  end
end

#must(matcher = nil) ⇒ Object

Use ‘must` nomenclature for assertions.

10.must.be.kind_of(Integer)


11
12
13
14
15
16
17
# File 'lib/fluidity/must.rb', line 11

def must(matcher=nil)
  if matcher
    matcher =~ self
  else
    ::Fluidity::Grammer::Must.new(self)
  end
end

#must_not(matcher = nil) ⇒ Object

Also, ‘will_not` nomenclature for assertions.

10.will_not.be.kind_of?(Integer)


23
24
25
26
27
28
29
# File 'lib/fluidity/must.rb', line 23

def must_not(matcher=nil)
  if matcher
    matcher !~ self
  else
    ::Fluidity::Grammer::Must.new(self, true)
  end
end

#mustntObject

Also, ‘must_not` nomenclature for assertions.

10.must_not.be.kind_of?(Integer)

Contraction do must not.

10.mustnt.be.kind_of?(Integer)


35
36
37
38
39
40
41
# File 'lib/fluidity/must.rb', line 35

def must_not(matcher=nil)
  if matcher
    matcher !~ self
  else
    ::Fluidity::Grammer::Must.new(self, true)
  end
end

#should(matcher = nil) ⇒ Object

Use ‘should` nomenclature for assertions.

10.should.be.kind_of(Integer)


9
10
11
12
13
14
15
# File 'lib/fluidity/should.rb', line 9

def should(matcher=nil)
  if matcher
    matcher =~ self
  else
    ::Fluidity::Grammer::Should.new(self)
  end
end

#should_not(matcher = nil) ⇒ Object Also known as: shouldnt

Also, ‘should_not` nomenclature for assertions.

10.should_not.be.kind_of?(Integer)


21
22
23
24
25
26
27
# File 'lib/fluidity/should.rb', line 21

def should_not(matcher=nil)
  if matcher
    matcher !~ self
  else
    ::Fluidity::Grammer::Should.new(self, true)
  end
end

#will(matcher = nil) ⇒ Object

Use ‘will` nomenclature for assertions.

10.will.be.kind_of(Integer)


9
10
11
12
13
14
15
# File 'lib/fluidity/will.rb', line 9

def will(matcher=nil)
  if matcher
    matcher =~ self
  else
    ::Fluidity::Grammer::Must.new(self)
  end
end