Sha256: 7938389125b29b3e8302660ac42f3014d88579b997f82cd8ba12e36d60572c83

Contents?: true

Size: 687 Bytes

Versions: 7

Compression:

Stored size: 687 Bytes

Contents

module Zermelo
  module Associations
    class AssociationData
      attr_writer   :data_klass_name, :related_klass_names
      attr_accessor :name, :type_klass, :data_type, :inverse, :sort_key,
        :sort_order, :callbacks

      def initialize(opts = {})
        [:name, :type_klass, :data_type, :inverse, :sort_key, :sort_order,
         :callbacks, :data_klass_name, :related_klass_names].each do |a|

          send("#{a}=".to_sym, opts[a])
        end
      end

      def data_klass
        @data_klass ||= @data_klass_name.constantize
      end

      def related_klasses
        @related_klasses ||= (@related_klass_names || []).map(&:constantize)
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
zermelo-1.4.3 lib/zermelo/associations/association_data.rb
zermelo-1.4.2 lib/zermelo/associations/association_data.rb
zermelo-1.4.1 lib/zermelo/associations/association_data.rb
zermelo-1.4.0 lib/zermelo/associations/association_data.rb
zermelo-1.3.0 lib/zermelo/associations/association_data.rb
zermelo-1.2.1 lib/zermelo/associations/association_data.rb
zermelo-1.2.0 lib/zermelo/associations/association_data.rb