Execute a helper block if it matches conditions
432242
def execute_helper(block, opts)
      if_condition = execute_helper_condition(opts[:if])
      unless_condition = !execute_helper_condition(opts[:unless], false)

      block.call if if_condition && unless_condition
    end
966449
function If(transform, node) {
  var if_ = ifHelper(transform, node);
  var block = es.BlockStatement(null, [if_]);
  var fn = es.FunctionExpression(null, null, [], block);
  return es.CallExpression(null, fn, []);
}
985810
def method_missing(slug, *args)
      return super unless (klass = filter(slug))

      options = args.last.is_a?(Hash) ? args.pop : {}

      yield(klass, args, options) if block_given?

      self
    end
860652
def execute(self, fn, *args, **kwargs):
        """"""
        if not self.asynchronous:
            return fn(*args, **kwargs)
        raise NotImplementedError
595390
def instance_methods_eval(&block)
      raise ArgumentError, "block required" unless block_given?

      context = eval('self', block.binding)

      context.send :push_redirection_target, self

      begin
        yield context
      ensure
        context.send :pop_redirection_target
      end

      self
    end
330240
def helper_method(name, *args, &block)
      if name.match /_path$/
        helpers.send(name, *args, &block)
      elsif (const_get([name, 'engine'].join('/').classify) rescue nil)
        helpers.send(name, *args, &block)
      else
        current_arbre_element.add_child helpers.send(name, *args, &block)
      end
    end
106892
def __execute_queries(self):
        """"""

        def func(item):
            or_check = False
            for queries in self._queries:
                and_check = True
                for query in queries:
                    and_check &= self._matcher._match(
                        item.get(query.get('key'), None),
                        query.get('operator'),
                        query.get('value')
                    )
                or_check |= and_check
            return or_check

        self._json_data = list(filter(lambda item: func(item), self._json_data))
623710
def error_block!(key, *block_params)
      base = settings
      while base.respond_to?(:errors)
        next base = base.superclass unless args_array = base.errors[key]
        args_array.reverse_each do |args|
          first = args == args_array.first
          args += [block_params]
          resp = process_route(*args)
          return resp unless resp.nil? && !first
        end
      end
      return false unless key.respond_to? :superclass and key.superclass < Exception
      error_block!(key.superclass, *block_params)
    end
668159
def handle?(req)
      if @opts.key?(:if)
        cond = @opts[:if]
        cond = cond.call(req) if cond.respond_to?(:call)
        return cond
      end
      true
    end
773883
def method_missing(*args, &block)
      # Get the configuration
      if args.last.is_a?(Hash)
        options = args.last
      else
        args << options = {}
      end
      
      # Get any existing condition that may need to be merged
      if_condition = options.delete(:if)
      unless_condition = options.delete(:unless)
      
      # Provide scope access to configuration in case the block is evaluated
      # within the object instance
      proxy = self
      proxy_condition = @condition
      
      # Replace the configuration condition with the one configured for this
      # proxy, merging together any existing conditions
      options[:if] = lambda do |*condition_args|
        # Block may be executed within the context of the actual object, so
        # it'll either be the first argument or the executing context
        object = condition_args.first || self
        
        proxy.evaluate_method(object, proxy_condition) &&
        Array(if_condition).all? {|condition| proxy.evaluate_method(object, condition)} &&
        !Array(unless_condition).any? {|condition| proxy.evaluate_method(object, condition)}
      end
      
      # Evaluate the method on the owner class with the condition proxied
      # through
      machine.owner_class.send(*args, &block)
    end
1210266
def method_missing(name, *args, **config, &block)
      if respond_to_missing?(name)
        config[:type] = name
        on(*args, config, &block)
      else
        super
      end
    end
846929
def select!
      if block_given?
        return_nil = true
        @data.each do |k,v|
          unless yield(k,v)
            @data.delete(k)
            return_nil = false
          end
        end
        return nil if return_nil
      end
      self
    end
1089676
def maybe(&block)
      if (result = block.call).nil?
        Data::Nothing.new
      else
        Data::Just.new(result)
      end
    end
1203158
def call_action(kind, *args, &block)
      GenSpec::Matchers::GenerationMethodMatcher.for_method(kind, *args, &block)
    end
36209
def execute_rule(rule, matches, context):
    
    if rule.enabled(context):
        log(rule.log_level, "Checking rule condition: %s", rule)
        when_response = rule.when(matches, context)
        if when_response:
            log(rule.log_level, "Rule was triggered: %s", when_response)
            log(rule.log_level, "Running rule consequence: %s %s", rule, when_response)
            rule.then(matches, when_response, context)
            return when_response
    else:
        log(rule.log_level, "Rule is disabled: %s", rule)
103938
def on_complete(&block)
      on do |_, value, reason|
        block.call(reason == nil, value, reason)
      end
    end
12708
def method_missing(name, *args, &block)
      helpers.key?(name) ? helpers.fetch(name).call : super
    end