Class: Forty::ACL
- Inherits:
-
Object
- Object
- Forty::ACL
- Defined in:
- lib/forty/acl.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(path_to_acl_file) ⇒ ACL
constructor
A new instance of ACL.
Constructor Details
#initialize(path_to_acl_file) ⇒ ACL
Returns a new instance of ACL.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/forty/acl.rb', line 5 def initialize(path_to_acl_file) raise('no path to ACL file provided') if path_to_acl_file.nil? or path_to_acl_file.empty? if File.exist?(path_to_acl_file) begin @acl = JSON.parse(File.read(path_to_acl_file)) rescue StandardError raise "ACL file #{path_to_acl_file} could not be parsed" end else raise("ACL file not found at: #{path_to_acl_file}") end end |
Instance Method Details
#[](key) ⇒ Object
19 20 21 |
# File 'lib/forty/acl.rb', line 19 def [](key) @acl[key] end |
#[]=(key, value) ⇒ Object
23 24 25 |
# File 'lib/forty/acl.rb', line 23 def []=(key, value) @acl[key] = value end |