Class: String
- Defined in:
- opal/stdlib/pp.rb,
 opal/stdlib/json.rb,
 opal/stdlib/native.rb,
 opal/stdlib/bigdecimal/util.rb
Overview
:nodoc:
Instance Method Summary collapse
- 
  
    
      #pretty_print(q)  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    :nodoc:. 
- 
  
    
      #to_d  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    call-seq: str.to_d -> bigdecimal. 
- 
  
    
      #to_n  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    The internal JavaScript value (with valueOf).
Instance Method Details
#pretty_print(q) ⇒ Object
:nodoc:
| 399 400 401 402 403 404 405 406 407 408 409 410 | # File 'opal/stdlib/pp.rb', line 399 def pretty_print(q) # :nodoc: lines = self.lines if lines.size > 1 q.group(0, '', '') do q.seplist(lines, lambda { q.text ' +'; q.breakable }) do |v| q.pp v end end else q.text inspect end end | 
#to_d ⇒ Object
call-seq: str.to_d -> bigdecimal
Returns the result of interpreting leading characters in +str+ as a BigDecimal.
require 'bigdecimal'
require 'bigdecimal/util'
"0.5".to_d             # => 0.5e0
"123.45e1".to_d        # => 0.12345e4
"45.67 degrees".to_d   # => 0.4567e2
See also BigDecimal::new.
| 68 69 70 | # File 'opal/stdlib/bigdecimal/util.rb', line 68 def to_d BigDecimal(`#{self}.replace("_", '').replace(/ .*$/,'')`) end | 
#to_n ⇒ Object
Returns the internal JavaScript value (with valueOf).
| 461 462 463 | # File 'opal/stdlib/native.rb', line 461 def to_n `self.valueOf()` end |