Module: Backbone::Generators::Helpers
- Included in:
- InstallGenerator, ScaffoldGenerator
- Defined in:
- lib/generators/backbone/helpers.rb
Instance Method Summary collapse
- #app_filename ⇒ Object
- #app_name ⇒ Object
- #asset_path ⇒ Object
- #collection_namespace ⇒ Object
- #js_path ⇒ Object
- #model_namespace ⇒ Object
- #namespaced_path ⇒ Object
- #namespaces ⇒ Object
- #rails_app_name ⇒ Object
- #router_namespace ⇒ Object
- #template_namespace ⇒ Object
- #template_path ⇒ Object
- #view_namespace ⇒ Object
Instance Method Details
#app_filename ⇒ Object
41 42 43 |
# File 'lib/generators/backbone/helpers.rb', line 41 def app_filename "#{namespaced_path}/#{rails_app_name.underscore}" end |
#app_name ⇒ Object
37 38 39 |
# File 'lib/generators/backbone/helpers.rb', line 37 def app_name rails_app_name.camelize + namespaces.map!{ |n| n.camelize }.join('') end |
#asset_path ⇒ Object
5 6 7 |
# File 'lib/generators/backbone/helpers.rb', line 5 def asset_path "app/assets" end |
#collection_namespace ⇒ Object
21 22 23 |
# File 'lib/generators/backbone/helpers.rb', line 21 def collection_namespace [app_name, "Collections", file_name.pluralize.camelize].join(".") end |
#js_path ⇒ Object
9 10 11 |
# File 'lib/generators/backbone/helpers.rb', line 9 def js_path "#{asset_path}/javascripts" end |
#model_namespace ⇒ Object
17 18 19 |
# File 'lib/generators/backbone/helpers.rb', line 17 def model_namespace [app_name, "Models", file_name.singularize.camelize].join(".") end |
#namespaced_path ⇒ Object
53 54 55 |
# File 'lib/generators/backbone/helpers.rb', line 53 def namespaced_path '/' + namespaces.join('/') end |
#namespaces ⇒ Object
49 50 51 |
# File 'lib/generators/backbone/helpers.rb', line 49 def namespaces [:namespace] ? [:namespace].split('/') : file_path.split('/')[0...-1] end |
#rails_app_name ⇒ Object
45 46 47 |
# File 'lib/generators/backbone/helpers.rb', line 45 def rails_app_name Rails.application.class.name.split('::').first end |
#router_namespace ⇒ Object
25 26 27 |
# File 'lib/generators/backbone/helpers.rb', line 25 def router_namespace [app_name, "Routers", file_name.pluralize.camelize].join(".") end |
#template_namespace ⇒ Object
33 34 35 |
# File 'lib/generators/backbone/helpers.rb', line 33 def template_namespace [file_path.pluralize, "index"].join("/") end |
#template_path ⇒ Object
13 14 15 |
# File 'lib/generators/backbone/helpers.rb', line 13 def template_path "#{asset_path}/templates" end |
#view_namespace ⇒ Object
29 30 31 |
# File 'lib/generators/backbone/helpers.rb', line 29 def view_namespace [app_name, "Views", "#{file_name.pluralize.camelize}Index"].join(".") end |