Sha256: e0f0687a427889a99f0030ee106d143a03e2fbd8e1e62d16e7c1be77f332d843
Contents?: true
Size: 921 Bytes
Versions: 4
Compression:
Stored size: 921 Bytes
Contents
module Alf class Relation module ClassMethods # # Coerces `val` to a relation. # # Recognized arguments are: Relation (identity coercion), Set of ruby hashes, # Array of ruby hashes, Alf::Iterator. # # @return [Relation] a relation instance for the given set of tuples # @raise [ArgumentError] when `val` is not recognized # def coerce(val) case val when Relation val when Set Relation.new(val) when Array Relation.new val.to_set when Iterator Relation.new val.to_set else raise ArgumentError, "Unable to coerce #{val} to a Relation" end end # (see Relation.coerce) def [](*tuples) coerce(tuples) end end # module ClassMethods extend(ClassMethods) end # class Relation end # module Alf
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
alf-0.11.1 | lib/alf/relation/class_methods.rb |
alf-0.11.0 | lib/alf/relation/class_methods.rb |
alf-0.10.1 | lib/alf/relation/class_methods.rb |
alf-0.10.0 | lib/alf/relation/class_methods.rb |