module RDF::Countable
@since 0.2.0
Public Instance Methods
Source
# File lib/rdf/mixin/countable.rb, line 25 def count count = 0 each { count += 1 } count end
Returns the number of RDF
statements in ‘self`.
@return [Integer]
Also aliased as: size
Source
# File lib/rdf/mixin/countable.rb, line 16 def empty? each {return false} true end
Returns ‘true` if `self` contains no RDF
statements.
@return [Boolean]
Source
# File lib/rdf/mixin/countable.rb, line 37 def enum_for(method = :each, *args) # Ensure that enumerators support the `#empty?` and `#count` methods: this = self Countable::Enumerator.new do |yielder| this.send(method, *args) {|y| yielder << y} end end
@private @param [Symbol, to_sym] method @return [Enumerator] @see Object#enum_for
Also aliased as: to_enum