convert takes in the key to the emoji to be converted and an optional block
 If block is provided, conversion will be done only if this block evaluates to true.
177192
def convert(key, block = nil)
      if block.nil? or block.call(key)
        img_tag(key)
      else
        ":#{key}:"
      end
    end
347061
function processMaybeBlock (node, baseToken) {
    const firstToken = getFirstAndLastTokens(node).firstToken
    setOffset(firstToken, isLeftBrace(firstToken) ? 0 : 1, baseToken)
  }
545363
@Override
  public Boolean decode(final String s) {
    checkNotNull(s);
    if ("true".equals(s)) {
      return Boolean.TRUE;
    } else if ("false".equals(s)) {
      return Boolean.FALSE;
    } else {
      throw new ConversionException(
          String.format("Strictly-converted booleans must be either 'true' or 'false', not %s", s));
    }
  }
560816
def get_as_boolean(self, key):
        
        value = self.get(key)
        return BooleanConverter.to_boolean(value)
1119149
public static Token parse(String block, byte[] key)
	  throws GeneralSecurityException
  {
 	  byte[] decoded = Modhex.decode(block);
 	  byte[] b = decrypt(key, decoded);
	  return new Token(b);
  }
189169
def _decode_key(self, key):
        
        bkey = codecs.decode(key.encode(self._keyencoding), 'hex_codec')
        return bkey.decode(self._keyencoding) if self._serialize else bkey
234092
function convertSource(key, inObj) {
	let source = inObj; // body, query : keep it as is
	
	if (inObj === 'header') {
		source = "headers";
	}
	if (inObj === 'formData') {
		source = "body";
	}
	if (inObj === 'path') {
		source = "params";
	}
	
	return [`${source}.${key}`];
}
772978
private static byte[] withCorrectBlockSize(final byte[] key) {
        if (key.length != CcAes.BLOCK) {
            throw new IllegalArgumentException(
                String.format(
                    "the length of the AES key must be exactly %d bytes",
                    CcAes.BLOCK
                )
            );
        }
        return key;
    }
556757
def converter(input_string, block_size=2):
    

    sentences = textprocessing.getSentences(input_string)
    blocks = textprocessing.getBlocks(sentences, block_size)
    parse.makeIdentifiers(blocks)
990256
def optional_belongs_to(*symbols, &block)
        options = symbols.extract_options!
        options.merge!(optional: true)
        belongs_to(*symbols, options, &block)
      end
1098590
def convert(jkf)
      jkf = jkf.is_a?(Hash) ? jkf : JSON.parse(jkf)
      convert_root(jkf)
    end
954337
def each
      return to_enum unless block_given?
      each_explicit_key do |*key|
        next if default?(*key)
        yield key, get(*key)
      end
    end
250353
def hash_value(key)
      if :hash == self.type
        value_node = self.children.find { |pair_node| pair_node.key.to_value == key }
        value_node ? value_node.value : nil
      else
        raise Synvert::Core::MethodNotSupported.new "has_key? is not handled for #{self.debug_info}"
      end
    end
1133933
def append(label, block)
      if store.key?(label.to_sym) && store[label.to_sym].respond_to?(:<<)
        store[label.to_sym] << block
      else
        store[label.to_sym] = []
        store[label.to_sym] << block
      end
    end
515662
private static void processEmoticonsToRegex() {
		
		List<String> emoticons=new ArrayList<String>();
		
		for(Emoji e: emojiData) {
			if(e.getEmoticons()!=null) {
				emoticons.addAll(e.getEmoticons());
			}
		}
		
		//List of emotions should be pre-processed to handle instances of subtrings like :-) :-
		//Without this pre-processing, emoticons in a string won't be processed properly
		for(int i=0;i<emoticons.size();i++) {
			for(int j=i+1;j<emoticons.size();j++) {
				String o1=emoticons.get(i);
				String o2=emoticons.get(j);
				
				if(o2.contains(o1)) {
					String temp = o2;
					emoticons.remove(j);
					emoticons.add(i, temp);
				}
			}
		}
		
		
		StringBuilder sb=new StringBuilder();
		for(String emoticon: emoticons) {
			if(sb.length() !=0) {
				sb.append("|");
			}
			sb.append(Pattern.quote(emoticon));
		}
		
		emoticonRegexPattern = Pattern.compile(sb.toString());
	}
1329773
public byte[] convertBlock(int[] input, int inPos, byte[] output, int numOfComponents, int startCoordinate,
                               int row, int scanlineStride) {
        int index = 0, inputOffset = 0, bounds = 0;
        int len = output.length;

        for (int i = 0; i < DCTSIZE; i++) {
            index = startCoordinate + i * scanlineStride;
            bounds = row * scanlineStride;

            for (int j = 0; j < DCTSIZE; j++) {
                if (index >= len) {
                    return output;
                }

                if (index < bounds) {
                    for (int c = 0; c < numOfComponents; c++) {
                        output[index++] = (byte) (255 - (input[inputOffset++] & 0xFF));
                    }
                } else {
                    inputOffset += numOfComponents;
                }
            }

            row++;
        }

        return output;
    }
1054546
protected void convertUnicode() {
        if (ch == '\\' && unicodeConversionBp != bp) {
            bp++; ch = buf[bp];
            if (ch == 'u') {
                do {
                    bp++; ch = buf[bp];
                } while (ch == 'u');
                int limit = bp + 3;
                if (limit < buflen) {
                    int d = digit(bp, 16);
                    int code = d;
                    while (bp < limit && d >= 0) {
                        bp++; ch = buf[bp];
                        d = digit(bp, 16);
                        code = (code << 4) + d;
                    }
                    if (d >= 0) {
                        ch = (char)code;
                        unicodeConversionBp = bp;
                        return;
                    }
                }
                log.error(bp, "illegal.unicode.esc");
            } else {
                bp--;
                ch = '\\';
            }
        }
    }