Class: ActiveMusicbrainz::Model::Factory

Inherits:
Object
  • Object
show all
Defined in:
lib/active_musicbrainz/models/factory.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.define(&block) ⇒ Object



4
5
6
7
8
# File 'lib/active_musicbrainz/models/factory.rb', line 4

def self.define &block
  factory = new
  factory.instance_eval &block if block_given?
  factory
end

Instance Method Details

#model(table_name, &block) ⇒ Object



10
11
12
13
14
# File 'lib/active_musicbrainz/models/factory.rb', line 10

def model table_name, &block
  klass = model_class table_name
  klass.class_eval &block if block_given?
  klass
end