ModraUp Ruby API Documentation Ruby API Reference

Class: String

Inherits:
Object
  • Object
show all

Overview

SketchUp adds a String#to_l method to String, parsing the text into a Length based on the current model units.

Examples:

"5'".to_l.to_f  #=> 60.0

Instance Method Summary # collapse

  • #to_l ⇒ Length
    Parse the string into a length. Use the unit (mm/cm/m/in/ft/' etc.) if it has a suffix, otherwise use the current model unit. Internally, it remains in inches. Return zero length for an empty string or a string containing only spaces.

Instance Method Details

string.to_l ⇒ Length

Parse the string into a length. Use the unit (mm/cm/m/in/ft/' etc.) if it has a suffix, otherwise use the current model unit. Internally, it remains in inches. Return zero length for an empty string or a string containing only spaces.

Returns:

  • (Length)

Raises:

  • [ArgumentError] Unable to parse

Examples:

"5'".to_l.to_f     #=> 60.0
"25.4mm".to_l.to_f #=> 1.0