Appends a new piece of ASCII data to this buffer and yields back any lines that are now complete.

 @param [String] data The new piece of ASCII data.

 @yieldparam [String] line The new line that is now complete.
496497
def process(data)
      @buffer << data

      lines = @buffer.split "\n"
      @buffer = @buffer.end_with?("\n") ? '' : lines.pop

      lines.each do |line|
        yield line.strip
      end
    end
5868
def insert_string(self, data):
        

        # First split string into lines
        lines = data.split('\n')

        while lines:
            line = lines[0]
            del lines[0]

            # Skip empty line
            if not line:
                continue

            # Skip comments
            if comment_re.match(line):
                continue

            # Handle continued lines
            while line[-1] == '\\':
                if lines:
                    line = line[:-1] + lines[0]
                    del lines[0]
                else:
                    line = line[:-1]
                    break

            # Split line into resource and value
            m = resource_spec_re.match(line)

            # Bad line, just ignore it silently
            if not m:
                continue

            res, value = m.group(1, 2)

            # Convert all escape sequences in value
            splits = value_escape_re.split(value)

            for i in range(1, len(splits), 2):
                s = splits[i]
                if len(s) == 3:
                    splits[i] = chr(int(s, 8))
                elif s == 'n':
                    splits[i] = '\n'

            # strip the last value part to get rid of any
            # unescaped blanks
            splits[-1] = splits[-1].rstrip()

            value = ''.join(splits)

            self.insert(res, value)
1278942
def writeln(self, data):
        
        self.f.write(" "*self.indent_level)
        self.f.write(data + "\n")
804726
def _append_to_data_parts(self, data, start, end):
        '''
        
        '''
        try:
            while data[start] == ' ':
                start += 1

            if start == end:
                end = len(data[start:])

            self.string_parts.append(data[start:end])
        except KeyboardInterrupt as e:
            raise e
        except Exception:
            try:
                self.string_parts.append(data[start:])
            except KeyboardInterrupt as e:
                raise e
            except Exception:
                pass

        return start
527282
def parse_line(line, &block) # :yields: request
      if request_data = file_format.parse_line(line) { |wt, message| warn(wt, message) }
        @parsed_lines += 1
        update_current_request(request_data.merge(source: @current_source, lineno: @current_lineno), &block)
      end
    end
302838
public function append($data, $whence = null, $whence_index = null)
    {
        $this->data = $this->appendSegment(
            $this->data,
            $this->validate($data),
            $whence,
            $whence_index
        );
    }
293364
function(data) {
		//if (this.debug) console.log("Data: [" + data + "]");
		if (this.echo) process.stdout.write(data);
		this.instream = '' + this.instream + data.toString();

		for (;;) {		// peel off full lines of input containing JSON
			var m = this.instream.match(/\n/);
			if (!m) break;			// no more full lines
			var first_line = this.instream.slice(0, m.index + 1).trim();
			this.instream = this.instream.slice(m.index + 1);

			//if (this.debug) console.log('Line:', [first_line], [this.instream]);

			if (first_line.match(this.prompt)) {
				this.sendReply();
				first_line = first_line.slice(this.promptlength);
				this.instream = first_line + '\n' + this.instream;	// push back command text
				continue;
			}

			if (first_line.charAt(0) == '{') {			// detect JSON update sent by Bitlash
				var json_payload = JSON.parse(first_line);
				//console.log('JSON upstream:', json_payload);
				if (this.json_callback) this.json_callback(json_payload);
			}
			else this.reply.push(first_line);
		}

		// detect prompt indicating last command is complete
		if (this.instream.match(this.prompt)) {
			this.sendReply();
			this.instream = this.instream.slice(this.promptlength);
		}
	}
123336
def insert(self, data):
        
        if not data:
            return
        data = self._compress_by_md5(data)
        # cut the first two place,route to different block by block_num
        name = self.key + str(int(data[0:2], 16) % self.block_num)
        for h in self.hash_function:
            local_hash = h.hash(data)
            self.server.setbit(name, local_hash, 1)
739805
def handle_data(self, data):
        
        self.log.debug( u'Encountered some data  : {0}'.format(data) )
        if not self.level:
            self.data.append(data)
1035050
def glue(data, options = {})
      template = partial_or_block(data, options) { yield }
      @template.add_node Nodes::Glue.new(template)
    end
1049151
def put(self, data):
        
        self._to_put.append(data)

        if self.should_flush():
            self.flush()
465140
public void append(byte[] data, int len) {
        if (data == null || len <= 0 || len > data.length)  {
            throw new IllegalArgumentException("Invalid combination of parameters data and length to append()");
        }

        int oldLimit = buffer.limit();
        // grow buffer if necessary
        grow(len);
        // set positing to begin writing immediately after the last byte of the current buffer
        buffer.position(oldLimit);
        // set the buffer limit to exactly the old size plus the new appendix length
        buffer.limit(oldLimit + len);
        // append data
        buffer.put(data, 0, len);
    }
757701
function (data) {
            this.source = data.source;

            var linesCount = 0;
            var coveredLinesCount = 0;

            for (var i in data) {
                if (i == "source") {
                    continue;
                }
                linesCount++;
                if (data[i] > 0) {
                    coveredLinesCount++;
                }
            }
            this.linesCount = linesCount;
            this.coveredLinesCount = coveredLinesCount;
        }
38747
def append_output(text)
      @mutex.synchronize do
        @buffer << RightScale::AuditProxy.force_utf8(text)
      end

      EM.next_tick do
        buffer_size = nil
        @mutex.synchronize do
          buffer_size = @buffer.size
        end

        if buffer_size > MAX_AUDIT_SIZE
          flush_buffer
        else
          reset_timer
        end
      end
    end
1289274
def set_data(new_data, mode)
      raise ArgumentError, "Data can't be set unless mode is :command or :merge" unless %i[command merge].include? mode
      raise ArgumentError, 'Data must be a hash when in merge mode' if mode == :merge && !new_data.is_a?(Hash)

      validate_rows new_data if mode == :command

      @data = new_data.dup
    end
705364
def update_data(new_data)
      @name = new_data[:name] || new_data['name'] || @name
      @hoist = new_data['hoist'] unless new_data['hoist'].nil?
      @hoist = new_data[:hoist] unless new_data[:hoist].nil?
      @colour = new_data[:colour] || (new_data['color'] ? ColourRGB.new(new_data['color']) : @colour)
    end
575811
def init_string(data, options)
      @type, @data = File.exist?(data) ? [:datafile, "'#{data}'"] : [:math_function, data.clone]
      @options = Hamster.hash(options)
    end