Sha256: 0d98a047dea75d21e1a02e676a1fc85ac2c8465265ce40029a283bc7baa11407

Contents?: true

Size: 697 Bytes

Versions: 11

Compression:

Stored size: 697 Bytes

Contents

module SdbDal


class Reference
    attr_accessor :target_class 
    attr_accessor :primary_key 
    attr_accessor :index 
  def initialize(options={})
      if options.has_key?(:target)
          self.target_class=options[:target].class.name.to_sym
          self.primary_key=options[:target].primary_key
      end
      self.index=-1
      if options.has_key?(:index)
          self.index=options[:index]
      end
  end
  def targets?(item)
      return false unless item 
      self.target_class==item.class.name.to_sym and self.primary_key==item.primary_key
  end
  def get_target
      the_class=Kernel.const_get(self.target_class)
      the_class.find(self.primary_key)
      
  end
end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sdb_dal-0.0.7 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.8 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.5 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.6 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.4 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.11 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.1 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.12 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.2 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.3 ./lib/sdb_dal/reference.rb
sdb_dal-0.0.9 ./lib/sdb_dal/reference.rb