Class: Erbac::Generators::ErbacGenerator
- Inherits:
-
Rails::Generators::Base
- Object
- Rails::Generators::Base
- Erbac::Generators::ErbacGenerator
- Defined in:
- lib/generators/erbac/erbac_generator.rb
Instance Method Summary collapse
- #copy_initializer_file ⇒ Object
-
#init_erbac_options ⇒ Object
def show_parameters puts “user: ” + self.user puts “auth_item: ” + self.options.inspect puts “auth_item_child: ” + self.options.inspect puts “auth_assignment: ” + self.options.inspect puts “options: ” + options.inspect end.
- #inject_user_class ⇒ Object
- #show_readme ⇒ Object
Instance Method Details
#copy_initializer_file ⇒ Object
49 50 51 |
# File 'lib/generators/erbac/erbac_generator.rb', line 49 def copy_initializer_file template "initializer.rb", "config/initializers/erbac.rb" end |
#init_erbac_options ⇒ Object
def show_parameters
puts "user: " + self.user
puts "auth_item: " + self.[:auth_item].inspect
puts "auth_item_child: " + self.[:auth_item_child].inspect
puts "auth_assignment: " + self.[:auth_assignment].inspect
puts "options: " + .inspect
end
34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/generators/erbac/erbac_generator.rb', line 34 def # TODO: check the validity of the name # assert options.auth_item[0] .auth_item[1] ||= .auth_item[0].classify || Configure::AUTH_ITEM_CLASS .auth_item[2] ||= .auth_item[0].tableize || Configure::AUTH_ITEM_TABLE # assert options.auth_item_child[0] .auth_item_child[1] || .auth_item_child[0].tableize || Configure::AUTH_ITEM_CHILD_TABLE # assert options.auth_assignment[0] .auth_assignment[1] || .auth_assignment[0].classify || Configure::AUTH_ASSIGNMENT_CLASS .auth_assignment[2] || .auth_assignment[0].tableize || Configure::AUTH_ASSIGNMENT_TABLE end |
#inject_user_class ⇒ Object
53 54 55 |
# File 'lib/generators/erbac/erbac_generator.rb', line 53 def inject_user_class invoke "erbac:user", [ self.user_class ] end |
#show_readme ⇒ Object
57 58 59 60 61 |
# File 'lib/generators/erbac/erbac_generator.rb', line 57 def show_readme if behavior == :invoke readme "README" end end |