Class: Struct
Overview
:nodoc:
Instance Method Summary collapse
-
#pretty_print(q) ⇒ Object
:nodoc:.
-
#pretty_print_cycle(q) ⇒ Object
:nodoc:.
-
#to_n ⇒ Object
values as values.
Instance Method Details
#pretty_print(q) ⇒ Object
:nodoc:
369 370 371 372 373 374 375 376 377 378 379 380 381 |
# File 'opal/stdlib/pp.rb', line 369 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:
383 384 385 |
# File 'opal/stdlib/pp.rb', line 383 def pretty_print_cycle(q) # :nodoc: q.text sprintf("#<struct %s:...>", PP.mcall(self, Kernel, :class).name) end |
#to_n ⇒ Object
values as values.
483 484 485 486 487 488 489 490 491 |
# File 'opal/stdlib/native.rb', line 483 def to_n result = `{}` each_pair do |name, value| `#{result}[#{name}] = #{Native.try_convert(value, value)}` end result end |