Module: Groovy::Model::HashTable

Defined in:
lib/groovy/model.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



375
376
377
# File 'lib/groovy/model.rb', line 375

def self.included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#initialize(key, attrs = nil, record = nil) ⇒ Object



401
402
403
404
# File 'lib/groovy/model.rb', line 401

def initialize(key, attrs = nil, record = nil)
  @key = key
  super(attrs, record)
end

#keyObject

def new_record?

key.nil?

end



414
415
416
# File 'lib/groovy/model.rb', line 414

def key
  @key || (record ? record._key : nil)
end

#load_recordObject



406
407
408
# File 'lib/groovy/model.rb', line 406

def load_record
  self.class.table[key]
end