Class: Merb::Generators::ModelGenerator

Inherits:
ComponentGenerator show all
Defined in:
lib/merb-gen/model.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generator

#initialize, #with_modules

Constructor Details

This class inherits a constructor from Merb::Generators::Generator

Class Method Details

.source_rootObject



5
6
7
# File 'lib/merb-gen/model.rb', line 5

def self.source_root
  File.join(super, 'model')
end

Instance Method Details

#attributes?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/merb-gen/model.rb', line 55

def attributes?
  self.attributes && !self.attributes.empty?
end

#attributes_for_accessorObject



59
60
61
# File 'lib/merb-gen/model.rb', line 59

def attributes_for_accessor
  self.attributes.keys.map{|a| ":#{a}" }.compact.uniq.join(", ")
end

#class_nameObject



43
44
45
# File 'lib/merb-gen/model.rb', line 43

def class_name
  self.name.camel_case
end

#file_nameObject



51
52
53
# File 'lib/merb-gen/model.rb', line 51

def file_name
  self.name.snake_case
end

#test_class_nameObject



47
48
49
# File 'lib/merb-gen/model.rb', line 47

def test_class_name
  self.class_name + "Test"
end