Method: Struct#values_at
- Defined in:
- opal/opal/rspec/fixes/opal/corelib/struct.rb
#values_at(*args) ⇒ Object
246 247 248 249 250 251 252 253 254 255 256 257 258 |
# File 'opal/opal/rspec/fixes/opal/corelib/struct.rb', line 246 def values_at(*args) args = args.map { |arg| `arg.$$is_range ? #{arg.to_a} : arg` }.flatten %x{ var result = []; for (var i = 0, len = args.length; i < len; i++) { if (!args[i].$$is_number) { #{raise TypeError, "no implicit conversion of #{`args[i]`.class} into Integer"} } result.push(#{self[`args[i]`]}); } return result; } end |