Module: Ballot::Generators
- Included in:
- InstallGenerator, SummaryGenerator
- Defined in:
- lib/generators/ballot.rb,
lib/generators/ballot/standalone.rb,
lib/generators/ballot/install/install_generator.rb,
lib/generators/ballot/summary/summary_generator.rb
Overview
The namespace for Ballot generators for Rails.
Defined Under Namespace
Classes: InstallGenerator, Standalone, SummaryGenerator
Instance Attribute Summary collapse
-
#orm ⇒ Object
:attr_reader: The ORM to use when generating the migrations.
Instance Method Summary collapse
-
#next_migration_number(_path) ⇒ Object
The next migration number.
-
#orm_has_migration? ⇒ Boolean
Indicates whether the ORM is supported by these generators.
-
#source_root ⇒ Object
The source root for the generator templates.
Instance Attribute Details
#orm ⇒ Object
:attr_reader: The ORM to use when generating the migrations.
10 11 12 13 14 15 16 |
# File 'lib/generators/ballot.rb', line 10 def orm if defined?(::Rails::Generators.) ::Rails::Generators.[:rails][:orm] else @orm || :active_record end end |
Instance Method Details
#next_migration_number(_path) ⇒ Object
The next migration number.
36 37 38 |
# File 'lib/generators/ballot.rb', line 36 def next_migration_number(_path) Time.now.utc.strftime('%Y%m%d%H%M%S') end |
#orm_has_migration? ⇒ Boolean
Indicates whether the ORM is supported by these generators.
31 32 33 |
# File 'lib/generators/ballot.rb', line 31 def orm_has_migration? i(active_record sequel).include? orm end |
#source_root ⇒ Object
The source root for the generator templates.
23 24 25 26 27 28 |
# File 'lib/generators/ballot.rb', line 23 def source_root File.( File.join('..', 'ballot', generator_name, 'templates', orm.to_s), __FILE__ ) end |