Class: Rails::Generators::MailboxGenerator
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Class Chain:
|
|
Instance Chain:
|
|
Inherits: |
Rails::Generators::NamedBase
|
Defined in: | actionmailbox/lib/rails/generators/mailbox/mailbox_generator.rb |
Class Method Summary
NamedBase
- Inherited
.check_class_collision | Add a class collisions name to be checked on class initialization. |
Base
- Inherited
.base_root | Returns the base root for a common set of generators. |
.default_source_root | Returns the default source root for a given generator. |
.desc | Tries to get the description from a USAGE file one folder above the source root otherwise uses a default description. |
.hide! | Convenience method to hide this generator from the available ones when running rails generator command. |
.hook_for | Invoke a generator based on the value supplied by the user to the given option named “name”. |
.namespace | Convenience method to get the namespace from the class name. |
.remove_hook_for | Remove a previously added hook. |
.source_root | Returns the source root for this generator using default_source_root as default. |
.add_shebang_option! | Small macro to add ruby as an option to the generator with proper default value plus an instance helper method called shebang. |
.banner | Use Rails default banner. |
.base_name | Sets the base_name taking into account the current class namespace. |
.default_aliases_for_option | Returns default aliases for the option name given doing a lookup in aliases. |
.default_for_option | Returns default for the option name given doing a lookup in config. |
.default_generator_root, | |
.default_value_for_option | Returns the default value for the option name given doing a lookup in options. |
.generator_name | Removes the namespaces and get the generator name. |
.usage_path |
Instance Attribute Summary
Instance Method Summary
- #create_mailbox_file
- #file_name private
NamedBase
- Inherited
#application_name | Tries to retrieve the application name or simply return application. |
#attributes_names, #class_name, #class_path, #edit_helper, #file_path, #fixture_file_name, #human_name, #i18n_scope, #index_helper, #model_resource_name, #namespaced_class_path, #new_helper, #plural_file_name, #plural_name, #plural_route_name, #plural_table_name, #redirect_resource_name, #regular_class_path, #route_url, #show_helper, | |
#singular_name | FIXME: We are avoiding to use alias because a bug on thor that make this method public and add it to the task list. |
#singular_route_name, #singular_table_name, #table_name, #url_helper_prefix |
Base
- Inherited
#extract_last_module | Takes in an array of nested modules and extracts the last module. |
#indent, | |
#module_namespacing | Wrap block with namespace of current application if namespace exists and is not skipped. |
#namespace, #namespaced_path, #wrap_with_namespace |
Actions
- Included
#add_source | Add the given source to |
#application | Alias for Actions#environment. |
#environment | Adds configuration code to a Rails runtime environment. |
#gem | Adds a |
#gem_group | Wraps gem entries inside a group. |
#generate | Runs another generator. |
#git | Runs one or more git commands. |
#github, | |
#initializer | Creates an initializer file in |
#lib | Creates a file in |
#rails_command | Runs the specified Rails command. |
#rake | Runs the specified Rake task. |
#rakefile | Creates a Rake tasks file in |
#readme | Reads the given file at the source root and prints it in the console. |
#route | Make an entry in Rails routing file |
#vendor | Creates a file in |
#execute_command | Runs the supplied command using either “rake …” or “rails …” based on the executor parameter provided. |
#indentation | Indent the |
#log | Define log for backwards compatibility. |
#optimize_indentation | Returns optimized string with indentation. |
#quote | Always returns value in double quotes. |
#with_indentation | Manage |
Instance Method Details
#create_mailbox_file
[ GitHub ]# File 'actionmailbox/lib/rails/generators/mailbox/mailbox_generator.rb', line 10
def create_mailbox_file template "mailbox.rb", File.join("app/mailboxes", class_path, "#{file_name}_mailbox.rb") in_root do if behavior == :invoke && !File.exist?(application_mailbox_file_name) template "application_mailbox.rb", application_mailbox_file_name end end end
#file_name (private)
[ GitHub ]# File 'actionmailbox/lib/rails/generators/mailbox/mailbox_generator.rb', line 23
def file_name # :doc: @_file_name ||= super.sub(/_mailbox\z/i, "") end