plexus / yaks

Ruby library for building hypermedia APIs
http://rubygems.org/gems/yaks
MIT License
236 stars 26 forks source link

map_to_primitive breaks when used with symbol.to_proc on ruby 2.4.0 #125

Open fnordfish opened 7 years ago

fnordfish commented 7 years ago

This is due to a bug in ruby 2.4.0's instance_exec this code (taken from the samples) will fail:

$yaks = Yaks.new do
  map_to_primitive Date, Time, DateTime, ActiveSupport::TimeWithZone, &:iso8601
end

However, converting it to the more verbose syntax works just fine:

$yaks = Yaks.new do
  map_to_primitive Date, Time, DateTime, ActiveSupport::TimeWithZone do |t| t.iso8601 end
end