Class: StringBuffer

Inherits:
String show all
Defined in:
lib/fOOrth/monkey_patch/string.rb

Overview

The StringBuffer class is the mutable variant of the String class.

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from String

#do_format_description, #foorth_coerce, #foorth_embed, #foorth_method_scan, #format_description, #split_if_huge, #split_if_over, #to_foorth_c, #to_foorth_n, #to_foorth_r

Constructor Details

#initialize(text = "") ⇒ StringBuffer

Create a string buffer from an object. Make sure that object is a string and make sure that string is not frozen.



81
82
83
# File 'lib/fOOrth/monkey_patch/string.rb', line 81

def initialize(text="")
  super(text)
end

Class Method Details

.create_foorth_instance(vm) ⇒ Object

Create an instance of StringBuffer.
Parameters:

  • vm - The current fOOrth virtual machine.



103
104
105
106
# File 'lib/fOOrth/monkey_patch/string.rb', line 103

def self.create_foorth_instance(vm)
  (obj = self.new).foorth_init(vm)
  obj
end

Instance Method Details

#foorth_string_freezeObject

Freeze only pure strings



96
97
98
# File 'lib/fOOrth/monkey_patch/string.rb', line 96

def foorth_string_freeze
  self
end

#full_clone(_arg = nil) ⇒ Object

A special patch for full_clone



91
92
93
# File 'lib/fOOrth/monkey_patch/string.rb', line 91

def full_clone(_arg=nil)
  self.clone
end

#safe_cloneObject

A special patch for safe_clone



86
87
88
# File 'lib/fOOrth/monkey_patch/string.rb', line 86

def safe_clone
  self.clone
end