<commit_before>
require 'jellyfish'



module Jellyfish
  module MultiActions
    Identity = lambda{|_|_}

    def call env
      @env = env
      acts = dispatch
      catch(:halt){
        acts.inject(nil){ |_, route_block| block_call(*route_block) }
      } || block_call(nil, Identity) # respond the default if halted
    end

    def dispatch
      ret = actions.map{ |(route, block)|
        case route
        when String
          [route, block] if route == path_info
        else#Regexp, using else allows you to use custom matcher
          match = route.match(path_info)
          [match, block] if match
        end
      }.compact

      if ret.empty?
        raise(Jellyfish::NotFound.new)
      else
        ret
      end
    end<commit_msg>multi_actions.rb: name it acts it's more clear<commit_after>
require 'jellyfish'



module Jellyfish
  module MultiActions
    Identity = lambda{|_|_}

    def call env
      @env = env
      acts = dispatch
      catch(:halt){
        acts.inject(nil){ |_, route_block| block_call(*route_block) }
      } || block_call(nil, Identity) # respond the default if halted
    end

    def dispatch
      acts = actions.map{ |(route, block)|
        case route
        when String
          [route, block] if route == path_info
        else#Regexp, using else allows you to use custom matcher
          match = route.match(path_info)
          [match, block] if match
        end
      }.compact

      if acts.empty?
        raise(Jellyfish::NotFound.new)
      else
        acts
      end
    end
{'fraction_non_alphanumeric': 0.0872093023255814, 'fraction_numerical': 0.0, 'mean_word_length': 2.037254901960784, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2988918', 'n_tokens_mistral': 464, 'n_tokens_neox': 442, 'n_words': 139}