Class: Sequel::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel_opal_runtime_patches.rb

Direct Known Subclasses

Sequel::D1::Database

Instance Method Summary collapse

Instance Method Details

#[](*args) ⇒ Object

homura patch (Phase 12): Opal represents Ruby Symbols as native JS strings, so ‘:table.is_a?(String)` returns true and sends `DB` down the `fetch(String)` path (which expects verbatim SQL). Explicit Symbol check routes correctly. upstream body: args.first.is_a?(String) ? fetch(*args) : from(*args)



21
22
23
24
25
26
27
28
29
30
# File 'lib/sequel_opal_runtime_patches.rb', line 21

def [](*args)
  first = args.first
  if first.is_a?(Symbol)
    from(*args)
  elsif first.is_a?(String)
    fetch(*args)
  else
    from(*args)
  end
end