Class: Struct
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(*args) ⇒ Struct
constructor
A new instance of Struct.
- #to_n ⇒ Object
Constructor Details
#initialize(*args) ⇒ Struct
Returns a new instance of Struct
382 383 384 385 386 387 388 389 390 391 392 393 394 |
# File 'opal/stdlib/native.rb', line 382 def initialize(*args) if args.length == 1 && native?(args[0]) object = args[0] members.each {|name| instance_variable_set "@#{name}", Native(`#{object}[#{name}]`) } else members.each_with_index {|name, index| instance_variable_set "@#{name}", args[index] } end end |
Instance Method Details
#to_n ⇒ Object
396 397 398 399 400 401 402 403 404 |
# File 'opal/stdlib/native.rb', line 396 def to_n result = `{}` each_pair {|name, value| `#{result}[#{name}] = #{value.to_n}` } result end |