[フレーム]

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:

386
387
388
389
390
391
392
393
394
395
396
397
398
# File 'opal/stdlib/pp.rb', line 386
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:

400
401
402
# File 'opal/stdlib/pp.rb', line 400
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

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

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