Class: Buhos::Reflection::Authorizations
- Inherits:
 - 
      Object
      
        
- Object
 - Buhos::Reflection::Authorizations
 
 
- Defined in:
 - lib/buhos/reflection.rb
 
Overview
Class to explore authorizations
Instance Attribute Summary collapse
- 
  
    
      #files  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute files.
 - 
  
    
      #permits  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    
Returns the value of attribute permits.
 
Instance Method Summary collapse
- #get_auth_from_haml ⇒ Object
 - #get_auth_from_ruby_files ⇒ Object
 - 
  
    
      #initialize(app)  ⇒ Authorizations 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    
A new instance of Authorizations.
 
Constructor Details
#initialize(app) ⇒ Authorizations
Returns a new instance of Authorizations.
      38 39 40 41 42 43 44 45 46  | 
    
      # File 'lib/buhos/reflection.rb', line 38 def initialize(app) @app=app @files={} @permits=[] get_auth_from_ruby_files get_auth_from_haml @permits.flatten!.uniq!.sort! @current_route=nil end  | 
  
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
      35 36 37  | 
    
      # File 'lib/buhos/reflection.rb', line 35 def files @files end  | 
  
#permits ⇒ Object (readonly)
Returns the value of attribute permits.
      36 37 38  | 
    
      # File 'lib/buhos/reflection.rb', line 36 def permits @permits end  | 
  
Instance Method Details
#get_auth_from_haml ⇒ Object
      63 64 65 66 67 68 69 70 71 72 73  | 
    
      # File 'lib/buhos/reflection.rb', line 63 def get_auth_from_haml Dir.glob("#{@app.dir_base}/views/*.haml").each do |v| File.open(v,"rb") do |fp| filename=v.gsub(@app.dir_base,"") @files[filename]={:nil=>[]} fp.each_line do |line| process_haml_line(filename, line) end end end end  | 
  
#get_auth_from_ruby_files ⇒ Object
      47 48 49 50 51 52 53 54 55 56 57 58 59  | 
    
      # File 'lib/buhos/reflection.rb', line 47 def get_auth_from_ruby_files Dir.glob("#{@app.dir_base}/**/*.rb").each do |v| @auth=[] next if v=~/\/spec\// or v=~/installer.rb/ File.open(v,"rb") do |fp| filename=v.gsub(@app.dir_base,"") @files[filename]={} fp.each_line do |line| process_line_ruby_file(filename, line) end end end end  |