Class: Synthra::Types::TextContent::SqlExpression

Inherits:
Base
  • Object
show all
Defined in:
lib/synthra/types/text_content/misc.rb

Overview

SqlExpression type

Instance Method Summary collapse

Instance Method Details

#generate_edge(rng, context, args) ⇒ Object



132
133
134
# File 'lib/synthra/types/text_content/misc.rb', line 132

def generate_edge(rng, context, args)
  ["", "SELECT 1", "DROP TABLE users"].sample(random: rng.instance_variable_get(:@random))
end

#generate_invalid(rng, context, args) ⇒ Object



136
137
138
# File 'lib/synthra/types/text_content/misc.rb', line 136

def generate_invalid(rng, context, args)
  [nil, 123, [], {}].sample(random: rng.instance_variable_get(:@random))
end

#generate_random(rng, context, args) ⇒ Object



126
127
128
129
130
# File 'lib/synthra/types/text_content/misc.rb', line 126

def generate_random(rng, context, args)
  value = args[:value] || "SELECT * FROM users"
  # Return as-is, but note this is intentionally not executed
  value
end