Class: HomuraSqlStringLiteral

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

Overview


String-buffer overrides: Sequel’s Dataset#sql_string_origin and literal_append allocate plain String instances which Opal treats as immutable — the ‘<<` accumulator pattern raises NotImplementedError. Replace the allocation sites with HomuraSqlBuffer, which implements the Sequel-expected subset of String (from lib/sequel_opal_patches.rb).


Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ HomuraSqlStringLiteral

Returns a new instance of HomuraSqlStringLiteral.



52
53
54
# File 'lib/sequel_opal_runtime_patches.rb', line 52

def initialize(value)
  @value = value.to_s
end

Instance Method Details

#sql_literal_allow_caching?(_dataset) ⇒ Boolean

Returns:

  • (Boolean)


60
61
62
# File 'lib/sequel_opal_runtime_patches.rb', line 60

def sql_literal_allow_caching?(_dataset)
  true
end

#sql_literal_append(dataset, sql) ⇒ Object



56
57
58
# File 'lib/sequel_opal_runtime_patches.rb', line 56

def sql_literal_append(dataset, sql)
  dataset.literal_string_append(sql, @value)
end