Sha256: 1b031d3be0a247f0f32c0ef6bf45b8894b1d8aa49af1a2d8a1bb0ace864ae176

Contents?: true

Size: 629 Bytes

Versions: 3

Compression:

Stored size: 629 Bytes

Contents

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

      def initialize(opts = {})
        [:name, :type_klass, :inverse, :sort_key, :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

3 entries across 3 versions & 1 rubygems

Version Path
zermelo-1.1.0 lib/zermelo/associations/association_data.rb
zermelo-1.0.1 lib/zermelo/associations/association_data.rb
zermelo-1.0.0 lib/zermelo/associations/association_data.rb