Module: RDF::Countable

Extended by:
Util::Aliasing::LateBound
Included in:
Enumerable, Graph, Repository
Defined in:
lib/rdf/mixin/countable.rb

Overview

Since:

Instance Method Summary (collapse)

Methods included from Util::Aliasing::LateBound

alias_method

Instance Method Details

- (Integer) count Also known as: size

Returns the number of RDF statements in self.

Returns:

  • (Integer)

Since:

  • 0.2.0



21
22
23
24
25
# File 'lib/rdf/mixin/countable.rb', line 21

def count
  count = 0
  each { count += 1 }
  count
end

- (Boolean) empty?

Returns true if self contains no RDF statements.

Returns:

  • (Boolean)

Since:

  • 0.2.0



11
12
13
14
15
# File 'lib/rdf/mixin/countable.rb', line 11

def empty?
  empty = true
  each { empty = false; break }
  empty
end