Sha256: 1904767e31a037767e60a283d3f9166a8f6673a212f8771f17ffd7efae90e083
Contents?: true
Size: 856 Bytes
Versions: 5
Compression:
Stored size: 856 Bytes
Contents
module RDF ## # @since 0.2.0 module Countable extend RDF::Util::Aliasing::LateBound ## # Returns `true` if `self` contains no RDF statements. # # @return [Boolean] def empty? empty = true each { empty = false; break } empty end ## # Returns the number of RDF statements in `self`. # # @return [Integer] def count count = 0 each { count += 1 } count end alias_method :size, :count alias_method :length, :count # @deprecated ## # @private # @param [Symbol, #to_sym] method # @return [Enumerator] # @see Object#enum_for def enum_for(method = :each, *args) # Ensure that enumerators support the `#empty?` and `#count` methods: super.extend(RDF::Countable) end alias_method :to_enum, :enum_for end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
rdf-0.2.3 | lib/rdf/mixin/countable.rb |
rdf-0.2.2 | lib/rdf/mixin/countable.rb |
rdf-0.2.1 | lib/rdf/mixin/countable.rb |
rdf-0.2.0.1 | lib/rdf/mixin/countable.rb |
rdf-0.2.0 | lib/rdf/mixin/countable.rb |