Module: ActiveRecord::Refined::AST

Defined in:
lib/active_record/refined/ast.rb

Defined Under Namespace

Modules: Arithmetics, BitwiseOperands, ComputedJson, JsonComparable, JsonDocument, JsonSteps, Predications, SetSubquery, Windowing Classes: Aggregate, And, Arithmetic, ArrayPredicate, As, Bitwise, BitwiseNot, Case, Cast, Collate, Column, Comparison, DatetimeValueFunction, DistinctFrom, Exists, Extract, Function, GroupingSets, In, JsonAggregate, JsonBuild, JsonContains, JsonExcept, JsonHasKey, JsonKeys, JsonLiteral, JsonPath, JsonSet, Like, Match, Node, Not, Operation, Or, Ordering, Over, Predicate, Quantified, Sql, StringAggregate, TruthValue, Value, WindowFunction

Class Method Summary collapse

Class Method Details

.check_name(name, pattern, what) ⇒ Object

Raises:

  • (ArgumentError)


31
32
33
34
# File 'lib/active_record/refined/ast.rb', line 31

def self.check_name(name, pattern, what)
  return name if pattern.match?(name.to_s)
  raise ArgumentError, "#{name.inspect} is not a plain #{what}"
end

.json_argument(value, model) ⇒ Object

A Ruby document or boolean written where JSON is wanted. Taken as it is, a document would be the string that spells it and a boolean SQLite's own 1. SQLite's json() marks the literal for the JSON functions; the MySQL family, which has no json(), reads it with JSON_EXTRACT.



41
42
43
# File 'lib/active_record/refined/ast.rb', line 41

def self.json_argument(value, model)
  Dialect.for(model).json_argument(value, model)
end