class EnumerateIt::Generators::EnumGenerator
Public Instance Methods
create_enumerate_it()
click to toggle source
# File lib/generators/enumerate_it/enum/enum_generator.rb, line 18 def create_enumerate_it template 'enumerate_it.rb', File.join('app/enumerations', "#{singular_name}.rb") end
create_locale()
click to toggle source
# File lib/generators/enumerate_it/enum/enum_generator.rb, line 13 def create_locale template 'locale.yml', File.join('config/locales', "#{singular_name}.yml") end
Private Instance Methods
default_lang()
click to toggle source
# File lib/generators/enumerate_it/enum/enum_generator.rb, line 24 def default_lang options[:lang] end
fields()
click to toggle source
# File lib/generators/enumerate_it/enum/enum_generator.rb, line 36 def fields if attributes.first.type == :string attributes.map(&:name) else attributes.map { |attribute| [attribute.name, attribute.type] } end end
locale_fields()
click to toggle source
# File lib/generators/enumerate_it/enum/enum_generator.rb, line 32 def locale_fields attributes.map(&:name) end
singular()
click to toggle source
# File lib/generators/enumerate_it/enum/enum_generator.rb, line 28 def singular singular_name end