module RDF::Countable
@since 0.2.0
Public Instance Methods
count()
click to toggle source
Returns the number of RDF statements in `self`.
@return [Integer]
# File lib/rdf/mixin/countable.rb, line 21 def count count = 0 each { count += 1 } count end
Also aliased as: size
empty?()
click to toggle source
Returns `true` if `self` contains no RDF statements.
@return [Boolean]
# File lib/rdf/mixin/countable.rb, line 12 def empty? each {return false} true end
enum_for(method = :each, *args)
click to toggle source
@private @param [Symbol, to_sym] method @return [Enumerator] @see Object#enum_for
# File lib/rdf/mixin/countable.rb, line 33 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
Also aliased as: to_enum