Sha256: ea905afd9e568fe35d6cc2af8fcd79237a1ab42a1eeaedae2524aed22ea22c5c
Contents?: true
Size: 736 Bytes
Versions: 17
Compression:
Stored size: 736 Bytes
Contents
module Ice module CubeAssociation def belongs_to(*args) args.each do |sym| belongs_to = %{ def #{sym} @source.#{sym}.to_ice end def #{sym}_id @source.#{sym}_id end } class_eval belongs_to end end def has_many(*args) args.each do |sym| has_many = %{ def #{sym} @source.#{sym}.map(&:to_ice) end def has_#{sym} ! @source.#{sym}.empty? end def num_#{sym} @source.#{sym}.count end def #{sym.to_s.singularize}_ids @source.#{sym.to_s.singularize}_ids end } class_eval has_many end end end end
Version data entries
17 entries across 17 versions & 1 rubygems