Class: Padrino::Admin::AccessControl::ProjectModule

Inherits:
Object
  • Object
show all
Defined in:
padrino-admin/lib/padrino-admin/access_control.rb

Overview

Project Module class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, path, options = {}) ⇒ ProjectModule

Returns a new instance of ProjectModule.



169
170
171
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 169

def initialize(name, path, options={})
  @name, @path, @options = name, path, options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



167
168
169
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 167

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



167
168
169
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 167

def options
  @options
end

Instance Method Details

#human_nameObject

Returns the name of the project module humanize them for you.



176
177
178
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 176

def human_name
   @name.to_s.humanize
end

#path(prefix = nil) ⇒ Object

Return the path of the project module. If a prefix given will be pre pended.

Examples:

# => /accounts/new
project_module.path
# => /admin/accounts
project_module.path("/admin")


189
190
191
192
193
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 189

def path(prefix=nil)
  path = prefix ? File.join(prefix, @path) : @path
  path = File.join(ENV['RACK_BASE_URI'].to_s, path) if ENV['RACK_BASE_URI']
  path
end