Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions lib/rdf/mixin/enumerable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def validate!
# @see #each_statement
# @see #enum_statement
def statements(**options)
Array(enum_statement)
enum_statement.to_a
end

##
Expand Down Expand Up @@ -311,7 +311,7 @@ def subjects(unique: true)
unless unique
enum_statement.map(&:subject) # TODO: optimize
else
Array(enum_subject)
enum_subject.to_a
end
end

Expand Down Expand Up @@ -376,7 +376,7 @@ def predicates(unique: true)
unless unique
enum_statement.map(&:predicate) # TODO: optimize
else
Array(enum_predicate)
enum_predicate.to_a
end
end

Expand Down Expand Up @@ -441,7 +441,7 @@ def objects(unique: true)
unless unique
enum_statement.map(&:object) # TODO: optimize
else
Array(enum_object)
enum_object.to_a
end
end

Expand Down Expand Up @@ -514,7 +514,7 @@ def terms(unique: true)
flatten.
compact
else
Array(enum_term)
enum_term.to_a
end
end

Expand Down Expand Up @@ -759,7 +759,7 @@ def dump(*args, **options)
# @overload #to_writer
# Implements #to_writer for each available instance of {RDF::Writer},
# based on the writer symbol.
#
#
# @return [String]
# @see {RDF::Writer.sym}
def method_missing(meth, *args)
Expand All @@ -780,7 +780,7 @@ def method_missing(meth, *args)
end

##
# @note this instantiates an writer; it could probably be done more
# @note this instantiates an writer; it could probably be done more
# efficiently by refactoring `RDF::Reader` and/or `RDF::Format` to expose
# a list of valid format symbols.
def respond_to_missing?(name, include_private = false)
Expand Down
8 changes: 8 additions & 0 deletions spec/mixin_enumerable_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@
end
end

context "Not using any deprecated method" do
%w(subjects predicates objects statements triples quads).each do |method|
it "##{method}" do
expect { subject.send(method.to_sym).to_a }.not_to output.to_stderr
end
end
end

context "Obtaining all unique values" do
%w(subjects predicates objects).each do |method|
it "##{method}" do
Expand Down