Class: Embryo::RubyTemplate::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-embryo/ruby_template/model.rb

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Model

Returns a new instance of Model.



6
7
8
# File 'lib/rails-embryo/ruby_template/model.rb', line 6

def initialize(name)
  @name = name.singularize
end

Instance Method Details

#class_nameObject



26
27
28
# File 'lib/rails-embryo/ruby_template/model.rb', line 26

def class_name
  @name.camelize
end

#pathObject



10
11
12
# File 'lib/rails-embryo/ruby_template/model.rb', line 10

def path
  @name.underscore
end

#pluralObject



22
23
24
# File 'lib/rails-embryo/ruby_template/model.rb', line 22

def plural
  singular.pluralize
end

#plural_class_nameObject



30
31
32
# File 'lib/rails-embryo/ruby_template/model.rb', line 30

def plural_class_name
  class_name.pluralize
end

#plural_pathObject



14
15
16
# File 'lib/rails-embryo/ruby_template/model.rb', line 14

def plural_path
  path.pluralize
end

#plural_symbolObject



38
39
40
# File 'lib/rails-embryo/ruby_template/model.rb', line 38

def plural_symbol
  symbol.pluralize
end

#singularObject



18
19
20
# File 'lib/rails-embryo/ruby_template/model.rb', line 18

def singular
  path.split("/").last
end

#symbolObject



34
35
36
# File 'lib/rails-embryo/ruby_template/model.rb', line 34

def symbol
  path.gsub("/", "_")
end