Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/rtkit/ruby_extensions.rb
Instance Method Summary collapse
-
#to_coordinate ⇒ Object
Converts a string (containing a ‘' separated x,y,z coordinate triplet) to a Coordinate instance.
Instance Method Details
#to_coordinate ⇒ Object
Converts a string (containing a ‘' separated x,y,z coordinate triplet) to a Coordinate instance.
159 160 161 162 163 |
# File 'lib/rtkit/ruby_extensions.rb', line 159 def to_coordinate values = self.split("\\").collect {|str| str.to_f} raise ArgumentError, "Unable to create coordinate. Expected a string containing 3 values, got #{values.length}" unless values.length >= 3 return RTKIT::Coordinate.new(values[0], values[1], values[2]) end |