Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/quaternion_c2/to_type.rb

Instance Method Summary collapse

Instance Method Details

#to_qQuaternion

Returns a quaternion which denotes the string form. The parser ignores leading whitespaces and trailing garbage. Any digit sequences can be separated by an underscore. Returns zero for null or garbage string.

Examples:

"1-2i-3/4j+0.56k".to_q #=> (1-2i-(3/4)*j+0.56k)
"foobarbaz".to_q       #=> (0+0i+0j+0k)


206
207
208
# File 'lib/quaternion_c2/to_type.rb', line 206

def to_q
	Quaternion.send(:parse, self, false).to_q
end