Class: Copper::DataTypes::String

Inherits:
DataType
  • Object
show all
Defined in:
lib/copper/data_types/string.rb

Constant Summary

Constants inherited from DataType

DataType::CLASS_MAP, DataType::DATATYPE_MAP

Instance Method Summary collapse

Methods inherited from DataType

#as, factory, get_class, #initialize, #value

Constructor Details

This class inherits a constructor from Copper::DataTypes::DataType

Instance Method Details

#at(index) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/copper/data_types/string.rb', line 17

def at(index)
	if index >= @value.size
		raise ParseError, "index #{index} out of bound [0..#{@result.size - 1}]"
	else
		return @value[index]
	end
end

#countObject



5
6
7
# File 'lib/copper/data_types/string.rb', line 5

def count
	return @value.size
end

#gsub(pattern, replacement) ⇒ Object



9
10
11
# File 'lib/copper/data_types/string.rb', line 9

def gsub(pattern, replacement)
	return @value.gsub(pattern, replacement)
end

#split(separator) ⇒ Object



13
14
15
# File 'lib/copper/data_types/string.rb', line 13

def split(separator)
	return @value.split(separator)
end