[フレーム]

Class: Struct

Inherits:
Object show all
Defined in:
opal/stdlib/pp.rb,
opal/stdlib/native.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#pretty_print(q) ⇒ Object

:nodoc:

385
386
387
388
389
390
391
392
393
394
395
396
397
# File 'opal/stdlib/pp.rb', line 385
def pretty_print(q) # :nodoc:
 q.group(1, sprintf("#<struct %s", PP .mcall (self, Kernel , :class).name), '>') {
 q.seplist(PP .mcall (self, Struct , :members), lambda { q.text "," }) {|member|
 q.breakable
 q.text member.to_s
 q.text '='
 q.group(1) {
 q.breakable ''
 q.pp self[member]
 }
 }
 }
end

#pretty_print_cycle(q) ⇒ Object

:nodoc:

399
400
401
# File 'opal/stdlib/pp.rb', line 399
def pretty_print_cycle(q) # :nodoc:
 q.text sprintf("#<struct %s:...>", PP .mcall (self, Kernel , :class).name)
end

#to_nObject

values as values.

Returns:

  • a JavaScript object with the members as keys and their

482
483
484
485
486
487
488
489
490
# File 'opal/stdlib/native.rb', line 482
def to_n
 result = `{}`
 each_pair do |name, value|
 `#{result}[#{name}] = #{Native .try_convert (value, value)}`
 end
 result
end

AltStyle によって変換されたページ (->オリジナル) /