Skip to content

Commit cf27f0c

Browse files
author
Thomas Johnson
authored
Merge pull request #359 from ruby-rdf/vocabulary-send
Allow `RDF::Vocabulary#send` and `#public_send`
2 parents e7b3289 + 6655057 commit cf27f0c

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

lib/rdf/vocabulary.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ def props; @properties ||= {}; end
448448
undef_method(*instance_methods.
449449
map(&:to_s).
450450
select {|m| m =~ /^\w+$/}.
451-
reject {|m| %w(object_id dup instance_eval inspect to_s class).include?(m) || m[0,2] == '__'}.
451+
reject {|m| %w(object_id dup instance_eval inspect to_s class send public_send).include?(m) || m[0,2] == '__'}.
452452
map(&:to_sym))
453453

454454
##

spec/vocabulary_spec.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,16 @@
2727
expect(subject["foo"]).to be_a(RDF::Vocabulary::Term)
2828
end
2929

30+
it "allows #send" do
31+
expect {subject.send(:foo)}.not_to raise_error
32+
expect(subject.send(:foo)).to be_a(RDF::Vocabulary::Term)
33+
end
34+
35+
it "allows #public_send" do
36+
expect {subject.public_send(:foo)}.not_to raise_error
37+
expect(subject.public_send(:foo)).to be_a(RDF::Vocabulary::Term)
38+
end
39+
3040
it "does not add to @@uris" do
3141
RDF::Vocabulary.new("http://example/")
3242
expect(RDF::Vocabulary.class_variable_get(:"@@uris")).to be_a(Hash)

0 commit comments

Comments
 (0)