Skip to content

Surprising response of RDF::Vocabulary to .send() #356

@ijdickinson

Description

@ijdickinson

I'm trying to dynamically generate some vocabulary terms. I tried this:

$ irb
irb(main):001:0> require 'rdf'
=> true
irb(main):002:0> v = RDF::Vocabulary.new('http://example.com/vocab#')
=> #<RDF::Vocabulary:0x2ac70d75a93c(http://example.com/vocab#)>
irb(main):003:0> v.foo
=> #<RDF::Vocabulary::Term:0x2ac70d8239e0 URI:http://example.com/vocab#foo>
irb(main):004:0> v.send(:foo)
ArgumentError: method name must be a Symbol but String is given
	from /home/ian/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rdf-2.2.9/lib/rdf/vocabulary.rb:513:in `method_missing'
	from /home/ian/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/rdf-2.2.9/lib/rdf/vocabulary.rb:513:in `method_missing'
	from (irb):4
	from /home/ian/.rbenv/versions/2.4.1/bin/irb:11:in `<main>'

Not what I was expecting.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions