Class: AuthorizedRailsScaffolds::Helper

Inherits:
Object
  • Object
show all
Includes:
Macros::ParentMacros, Macros::PathMacros, Macros::ResourceMacros
Defined in:
lib/authorized_rails_scaffolds/helper.rb

Instance Method Summary collapse

Methods included from Macros::ResourceMacros

#resource_array_name, #resource_array_sym, #resource_array_var, #resource_class, #resource_directory, #resource_human_name, #resource_name, #resource_symbol, #resource_var

Methods included from Macros::PathMacros

#controller_edit_route, #controller_index_path, #controller_index_route, #controller_new_route, #controller_show_route, #references_show_route

Methods included from Macros::ParentMacros

#model_parent_name, #parent_model_names, #parent_models, #parent_module_groups, #parent_modules, #parent_sym, #parent_variable, #parent_variables

Constructor Details

#initialize(options = {}) ⇒ Helper

Returns a new instance of Helper.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/authorized_rails_scaffolds/helper.rb', line 7

def initialize(options = {})
  # @local_class_name = options[:local_class_name]

  # Fix for potentially plural file_name value
  file_name = options[:file_name]
  file_name = file_name.singularize unless file_name.nil?

  @var_name = options[:var_name] || file_name # Non-namespaced variable name

  # Pluralized non-namespaced variable name
  @plural_var_name ||= options[:plural_var_name]

  # Determine namespace prefix i.e awesome
  # options[:namespace_prefix]

  @singular_table_name = options[:singular_table_name]

  @human_name = options[:human_name]
end

Instance Method Details

#plural_var_nameObject



32
33
34
# File 'lib/authorized_rails_scaffolds/helper.rb', line 32

def plural_var_name
  @plural_var_name
end

#shallow_routes?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/authorized_rails_scaffolds/helper.rb', line 36

def shallow_routes?
  !!AuthorizedRailsScaffolds.config.shallow_routes
end

#var_nameObject

Non-namespaced variable name (i.e. foo_bar)



28
29
30
# File 'lib/authorized_rails_scaffolds/helper.rb', line 28

def var_name
  @var_name
end