Class: Wiris::Std

Inherits:
Object
  • Object
show all
Defined in:
lib/src-generic/Std.rb

Constant Summary collapse

@@random =
nil

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.charCodeAt(str, i) ⇒ Object



40
41
42
# File 'lib/src-generic/Std.rb', line 40

def self.charCodeAt(str, i)
			return str[i].ord
end

.fromCharCode(c) ⇒ Object



36
37
38
# File 'lib/src-generic/Std.rb', line 36

def self.fromCharCode(c)
			return c.chr(Encoding::UTF_8)
end

.is(o, cls) ⇒ Object

Raises:

  • (Exception)


7
8
9
# File 'lib/src-generic/Std.rb', line 7

def self.is(o, cls)
	 raise Exception,'Error: '+ __callee__.to_s  + ' method not defined'
end

.parseFloat(number) ⇒ Object



27
28
29
# File 'lib/src-generic/Std.rb', line 27

def self.parseFloat(number)
	return Float(number)
end

.parseInt(number) ⇒ Object



23
24
25
# File 'lib/src-generic/Std.rb', line 23

def self.parseInt(number)
	return Integer(number)
end

.random(x) ⇒ Object



66
67
68
69
70
71
# File 'lib/src-generic/Std.rb', line 66

def self.random(x) 
  if @@random == nil
  	@@random = Random.new()
  end
  return @@random.rand(x)
end

.random=(random) ⇒ Object



63
64
65
# File 'lib/src-generic/Std.rb', line 63

def self.random=(random)
	@@random=random
end

.split(str, delimitator) ⇒ Object



56
57
58
59
60
# File 'lib/src-generic/Std.rb', line 56

def self.split(str, delimitator)
	arr = Array.new()
	str.split(delimitator).each {|x| arr.push(x)}
			return arr
end

.substr(text, x0, length = -1)) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/src-generic/Std.rb', line 11

def self.substr(text, x0, length=-1)
	if length==-1
		text[x0..text.length]
	else
		text[x0,length] # Strings starts at 0
	end
end

.trace(s) ⇒ Object



3
4
5
# File 'lib/src-generic/Std.rb', line 3

def self.trace(s)
	puts s
end

Instance Method Details

#copyInto(array, cs) ⇒ Object

Raises:

  • (Exception)


44
45
46
# File 'lib/src-generic/Std.rb', line 44

def copyInto(array, cs)
			raise Exception,'Error: '+ __callee__.to_s  + ' method not defined'
end

#exit(n) ⇒ Object

Raises:

  • (Exception)


48
49
50
# File 'lib/src-generic/Std.rb', line 48

def exit(n)
			raise Exception,'Error: '+ __callee__.to_s  + ' method not defined'
end

#parseDouble(number) ⇒ Object

Deprecated.

Raises:

  • (Exception)


32
33
34
# File 'lib/src-generic/Std.rb', line 32

def parseDouble(number)
			raise Exception,'Error: '+ __callee__.to_s  + ' method not defined'
end

#random(x) ⇒ Object

Raises:

  • (Exception)


52
53
54
# File 'lib/src-generic/Std.rb', line 52

def random(x)
			raise Exception,'Error: '+ __callee__.to_s  + ' method not defined'
end

#split(text, delimitator) ⇒ Object

Raises:

  • (Exception)


19
20
21
# File 'lib/src-generic/Std.rb', line 19

def split(text, delimitator)
	raise Exception,'Error: '+ __callee__.to_s  + ' method not defined'
end