Class: Resty::Generators::ModelGenerator
- Defined in:
- lib/generators/resty/model/model_generator.rb
Instance Method Summary collapse
- #actions ⇒ Object
- #controller_class_name ⇒ Object
- #create_cache_file ⇒ Object
- #create_event_files ⇒ Object
- #create_model_file ⇒ Object
- #create_rest_service_file ⇒ Object
Instance Method Details
#actions ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/generators/resty/model/model_generator.rb', line 40 def actions @actions ||= begin keys = action_map.keys if [:singleton] keys.delete('index') keys.delete('create') keys.delete('destroy') end if [:read_only] keys.delete('update') keys.delete('create') keys.delete('destroy') end keys end end |
#controller_class_name ⇒ Object
36 37 38 |
# File 'lib/generators/resty/model/model_generator.rb', line 36 def controller_class_name @controller_class_name ||= class_name.pluralize end |
#create_cache_file ⇒ Object
21 22 23 24 25 |
# File 'lib/generators/resty/model/model_generator.rb', line 21 def create_cache_file if ![:singleton] && ![:read_only] template 'Cache.java', File.join(java_root, caches_package.gsub(/\./, "/"), class_path, "#{class_name.pluralize}Cache.java") end end |
#create_event_files ⇒ Object
27 28 29 30 |
# File 'lib/generators/resty/model/model_generator.rb', line 27 def create_event_files template 'Event.java', File.join(java_root, events_package.gsub(/\./, "/"), class_path, "#{class_name}Event.java") template 'EventHandler.java', File.join(java_root, events_package.gsub(/\./, "/"), class_path, "#{class_name}EventHandler.java") end |
#create_model_file ⇒ Object
17 18 19 |
# File 'lib/generators/resty/model/model_generator.rb', line 17 def create_model_file template 'Model.java', File.join(java_root, models_package.gsub(/\./, "/"), class_path, "#{class_name}.java") end |
#create_rest_service_file ⇒ Object
32 33 34 |
# File 'lib/generators/resty/model/model_generator.rb', line 32 def create_rest_service_file template 'RestService.java', File.join(java_root, restservices_package.gsub(/\./, "/"), class_path, "#{controller_class_name}RestService.java") end |