Class: Backyard::Adapter

Inherits:
Object
  • Object
show all
Defined in:
lib/backyard/adapter.rb

Direct Known Subclasses

FactoryGirl

Defined Under Namespace

Classes: FactoryGirl

Instance Method Summary collapse

Instance Method Details

#class_for_type(model_type) ⇒ Object



4
5
6
# File 'lib/backyard/adapter.rb', line 4

def class_for_type(model_type)
  model_type.to_s.split('_').map!{ |w| w.capitalize }.join
end

#create(model_type, attributes) ⇒ Object

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/backyard/adapter.rb', line 12

def create(model_type, attributes)
  raise NotImplementedError
end

#generate_model_name(model_type) ⇒ Object



8
9
10
# File 'lib/backyard/adapter.rb', line 8

def generate_model_name(model_type)
  "#{model_type.to_s.capitalize} #{Time.now.to_f}".tap{|s| s << s.object_id.to_s}
end