lib/resource_kit/action.rb in resource_kit-0.1.0 vs lib/resource_kit/action.rb in resource_kit-0.1.1

- old
+ new

@@ -29,15 +29,17 @@ def handlers @handlers ||= {} end def handler(*response_codes, &block) - response_codes.each do |code| - unless code.is_a?(Fixnum) - code = StatusCodeMapper.code_for(code) + if response_codes.empty? + handlers[:any] = block + else + response_codes.each do |code| + code = StatusCodeMapper.code_for(code) unless code.is_a?(Fixnum) + handlers[code] = block end - handlers[code] = block end end def body(&block) @body_handler = block if block_given? @@ -59,6 +61,6 @@ end nil end end -end \ No newline at end of file +end