Adapt StopTime::Mab#mab_done to follow Mab 0.0.3 API changes

This commit is contained in:
Paul van Tilburg 2013-06-16 15:17:13 +02:00
parent aa79757af4
commit 800dd3106f

View file

@ -88,13 +88,13 @@ module StopTime::Mab
SUPPORTED = [:get, :post]
def mab_done(tag)
return super unless tag.name == :form
return super unless tag._name == :form
meth = tag.attributes[:method]
tag.attributes[:method] = 'post' if override = !SUPPORTED.include?(meth)
meth = tag._attributes[:method]
tag._attributes[:method] = 'post' if override = !SUPPORTED.include?(meth)
# Inject a hidden input element with the proper method to the tag block
# if the form method is unsupported.
tag.block do |orig_blk|
tag._block do |orig_blk|
input :type => 'hidden', :name => '_method', :value => meth
orig_blk.call
end if override