Class: LockedKeys
- Inherits:
-
Object
- Object
- LockedKeys
- Defined in:
- lib/locked_keys.rb
Instance Method Summary collapse
-
#initialize(root_path) ⇒ LockedKeys
constructor
A new instance of LockedKeys.
- #locked?(full_key) ⇒ Boolean
Constructor Details
#initialize(root_path) ⇒ LockedKeys
Returns a new instance of LockedKeys.
2 3 4 5 6 7 8 9 |
# File 'lib/locked_keys.rb', line 2 def initialize(root_path) @locked_patterns = [] fullpath = File.join(root_path, 'locked_keys') if File.exists? fullpath read_locked_patterns(fullpath) unless File.directory?(fullpath) end end |
Instance Method Details
#locked?(full_key) ⇒ Boolean
11 12 13 14 15 16 17 18 19 |
# File 'lib/locked_keys.rb', line 11 def locked?(full_key) @locked_patterns.each do |pattern| if full_key =~ pattern return true end end false end |