Sha256: 740e695ec31ef5e64375c92e56ebc4fdf8711f91509d0276c48ffbee45f02627
Contents?: true
Size: 866 Bytes
Versions: 9
Compression:
Stored size: 866 Bytes
Contents
module Bmg module Algebra module Shortcuts def rxmatch(attrs, matcher, options = {}) predicate = attrs.inject(Predicate.contradiction){|p,a| p | Predicate.match(a, matcher, options) } self.restrict(predicate) end def prefix(prefix) raise "Attrlist must be known to use `prefix`" unless self.type.knows_attrlist? renaming = self.type.to_attrlist.each_with_object({}){|a,r| r[a] = :"#{prefix}#{a}" } self.rename(renaming) end def suffix(suffix) raise "Attrlist must be known to use `suffix`" unless self.type.knows_attrlist? renaming = self.type.to_attrlist.each_with_object({}){|a,r| r[a] = :"#{a}#{suffix}" } self.rename(renaming) end end # module Shortcuts end # module Algebra end # module Bmg
Version data entries
9 entries across 9 versions & 1 rubygems