Replace a commented out entry and return `true`,
 or do nothing and return `false`.
 @return [Boolean]
765390
def uncomment(key, value, tree)
      # Try to find if it is commented out, so we can replace line
      matcher = Matcher.new(
        collection:    "#comment",
        # FIXME: this assumes a specific "=" syntax, bypassing the lens
        # FIXME: this will match also "# If you set FOO=bar then..."
        value_matcher: /(\s|^)#{key}\s*=/
      )
      return false unless tree.data.any?(&matcher)

      # FIXME: this assumes that *data* is an AugeasTree
      tree.add(key, value, ReplacePlacer.new(matcher))
      true
    end
1244664
function cssReplace (content, replacer) {
  // replace all comments to comment mark /*{ID}*/
  const comments = []
  content = content.replace(COMMENT_RULE, (comment) => {
    const id = comments.length
    comments.push(comment)
    return `/*${id}*/`
  })

  // replace @import with replacer
  content = content.replace(RESOLVE_RULE, (statement, urlPath) => {
    if (statement.startsWith('@import')) {
      // remove possible comments
      statement = statement.replace(COMMENT_RULE, '')

      const parsed = parseImport(statement)
      if (!parsed.length) {
        throw new Error(`parse rule ${statement} failed`)
      }

      /**
       * parsed[0]: {
       *   path: 'foobar.css',
       *   condition: 'print',
       *   rule: '@import url("foobar.css") print'
       * }
       */
      return replacer(Object.assign({
        type: 'import'
      }, parsed[0]))
    } else {
      // remove possible comments
      urlPath = urlPath.replace(COMMENT_RULE, '').trim()

      const clearPath = urlPath.replace(/['"]/g, '')

      return replacer({
        type: 'url',
        path: clearPath,
        condition: '',
        rule: `url(${urlPath})`
      })
    }
  })

  // replace back from comment mark to real comment
  content = content.replace(COMMENT_RULE, (comment, id) => {
    return comments[id | 0]
  })

  return content
}
1233045
def check_for_strings_to_replace
        if @replace_strings.nil? || @replace_strings.empty?
          return false
        else
          puts "\nChecking for strings to replace inside files...\n\n"
          @replace_strings.each do |file|
            if file[:target_path].nil? || file[:symbols].nil?
              return false
            else
              puts "Target file: #{file[:target_path].green}\n"
              puts "Strings to replace:\n\n"
              check_replace_string_pairs_for_project_name_sub(file[:symbols])
              file[:symbols].each do |x,y|
                puts "Key:    #{x.to_s.green}"
                puts "Value:  #{y.to_s.green}\n\n"
              end
              puts "\n"
              path = FileUtils.join_paths(@install_path, @project_name, file[:target_path])
              FileUtils.replace_strings(path, file[:symbols])
            end
          end
        end
      end
483955
def moderate(self, comment, entry, request):
        
        if self.auto_moderate_comments:
            return True

        if check_is_spam(comment, entry, request,
                         self.spam_checker_backends):
            return True

        return False
1331106
def replace(self, ):
        
        tfi = self.get_taskfileinfo_selection()
        if tfi:
            self.reftrack.replace(tfi)
574596
def replace data_hash = {}
    sql, *binds = SQLHelper.replace :table => name,
                                    :data => @query_default.merge(data_hash),
                                    :prepared => true
    pstmt = prepare :insert, sql
    pstmt.send @update_method, *binds
  end
1128567
function patch(entry) {
  var description = entry.note
  var source = entry.source
  var result = {
    id: null,
    type: entry.type,
    apostrophe: entry.apostrophe ? true : undefined,
    categories: entry.categories,
    considerate: entry.considerate,
    inconsiderate: entry.inconsiderate,
    condition: entry.condition
  }

  if (source) {
    if (description) {
      description += ' (source: ' + source + ')'
    } else {
      description = 'Source: ' + source
    }
  }

  result.note = description
  result.id = getPatternId(result)

  return result
}
582298
def replace_matcher(part, new_matcher)
      key = key_for(part)
      @components[key] = new_matcher.with_attribute(:name => /\(#{key}\)/)
    end
57469
public static boolean replaceEntry(File zip, ZipEntrySource entry, File destZip) {
    return replaceEntries(zip, new ZipEntrySource[] { entry }, destZip);
  }
724668
def replace_sections(diary)
		return if diary.nil? or !diary.categorizable?

		categorized = categorize_diary(diary)
		categories = restore_categories
		deleted = []
		ymd = diary.date.strftime('%Y%m%d')

		@plugin.__send__(:transaction, 'category') do |db|
			categories.each do |c|
				cat = get(db, c) || {}
				if diary.visible? and categorized[c]
					cat.update(categorized[c])
					set(db, c, cat)
				else
					# diary is invisible or sections of this category is deleted
					cat.delete(ymd)
					if cat.empty?
						db.delete(c)
						deleted << c
					else
						set(db, c, cat)
					end
				end
			end

			if !deleted.empty?
				replace_categories(categories - deleted)
			end
		end
	end
1192179
def replace_last(action)
      raise ArgumentError, "Parameter, 'action', expected to be a #{Action}, but received: #{action}" unless action.is_a? Action

      @actions[@last_done].undo
      @actions[@last_done] = action
      action.do

      nil
    end
560634
boolean replaceIncrementalSourceAst(JsAst ast) {
    CompilerInput oldInput = getInput(ast.getInputId());
    checkNotNull(oldInput, "No input to replace: %s", ast.getInputId().getIdName());
    Node newRoot = checkNotNull(ast.getAstRoot(this));
    Node oldRoot = oldInput.getAstRoot(this);
    oldRoot.replaceWith(newRoot);

    CompilerInput newInput = new CompilerInput(ast);
    putCompilerInput(ast.getInputId(), newInput);

    JSModule module = oldInput.getModule();
    if (module != null) {
      module.addAfter(newInput, oldInput);
      module.remove(oldInput);
    }

    // Verify the input id is set properly.
    checkState(newInput.getInputId().equals(oldInput.getInputId()));
    InputId inputIdOnAst = newInput.getAstRoot(this).getInputId();
    checkState(newInput.getInputId().equals(inputIdOnAst));

    return true;
  }
565394
def replace_child( to_replace, replacement )
      @children.map! {|c| c.equal?( to_replace ) ? replacement : c }
      to_replace.parent = nil
      replacement.parent = self
    end
1307307
def undelete
      security_transgression_unless @comment.can_be_deleted_by?(@user)

      @comment.errors.add(:base, t('commontator.comment.errors.not_deleted')) \
        unless @comment.undelete_by(@user)

      respond_to do |format|
        format.html { redirect_to @thread }
        format.js { render :delete }
      end
    end
257740
def transform_comments(separator, &block)
      if @comments.empty?
        nil
      else
        block ||= lambda { |c| c }
        @comments.map(&block).join(separator)
      end
    end
1164326
def delete(entry)
      raise(ArgumentError, 'Must be an Entry') unless entry.is_a?(PoParser::Entry)

      @entries.delete(entry)
    end
145153
def replace(self, **kwargs):
        
        if 'usage_key' in kwargs:
            for attr in self.USAGE_KEY_ATTRS:
                kwargs.pop(attr, None)
        else:
            kwargs['usage_key'] = self.usage_key.replace(**{
                key: kwargs.pop(key)
                for key
                in self.USAGE_KEY_ATTRS
                if key in kwargs
            })
        return super(AsideUsageKeyV2, self).replace(**kwargs)