[フレーム]

Class: Struct

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

Direct Known Subclasses

SourceMap::Mapping

Instance Method Summary collapse

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_nObject

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

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