lib/alf.rb in alf-0.12.0 vs lib/alf.rb in alf-0.12.1

- old
+ new

@@ -45,9 +45,30 @@ def self.lispy(env = Environment.default) lispy = Object.new.extend(Lispy) lispy.environment = Environment.coerce(env) lispy end + + # + # Coerces some arguments to a relation. + # + # The following coercions are supported: + # + # Alf::Relation(x) + # # x.to_relation if it exists + # + # Alf::Relation(:attr => [val1, ..., valn]) + # # Relation([{:attr => val1}, ..., {:attr => valn}]) + # + # Alf::Relation(:attr1 => val1, ..., :attrn => valn) + # # Relation([{:attr1 => val1, ..., :attrn => valn}]) + # + # Alf::Relation([ {...}, ..., {...} ]) + # # the common coercion from an array of tuples + # + def self.Relation(*args) + Alf::Tools.to_relation(*args) + end end # module Alf require_relative "alf-engine/alf/engine" require_relative "alf-sequel/alf/sequel"