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



173
174
175
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 173

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name



171
172
173
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 171

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options



171
172
173
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 171

def options
  @options
end

Instance Method Details

#human_nameObject

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



180
181
182
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 180

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")


193
194
195
196
197
# File 'padrino-admin/lib/padrino-admin/access_control.rb', line 193

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