Module: Otori::Hanami::Action::ClassMethods
- Defined in:
- lib/otori/hanami.rb
Instance Method Summary collapse
Instance Method Details
#honeypot(name, wait: nil, &on_caught) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/otori/hanami.rb', line 13 def honeypot(name, wait: nil, &on_caught) field_name = name field_wait = wait caught_block = on_caught before do |request, response| next unless Otori.caught?( field_name, params: request.params.to_h, session: request.session, wait: field_wait ) if caught_block instance_exec(request, response, &caught_block) else halt 204 end end end |