Class: Rex::JSONHashFile
- Inherits:
-
Object
- Object
- Rex::JSONHashFile
- Defined in:
- lib/rex/json_hash_file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #[](k) ⇒ Object
- #[]=(k, v) ⇒ Object
- #clear ⇒ Object
- #delete(k) ⇒ Object
-
#initialize(path) ⇒ JSONHashFile
constructor
A new instance of JSONHashFile.
- #keys ⇒ Object
Constructor Details
#initialize(path) ⇒ JSONHashFile
Returns a new instance of JSONHashFile.
14 15 16 17 18 19 |
# File 'lib/rex/json_hash_file.rb', line 14 def initialize(path) self.path = path @lock = Mutex.new @hash = {} @last = 0 end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
12 13 14 |
# File 'lib/rex/json_hash_file.rb', line 12 def path @path end |
Instance Method Details
#[](k) ⇒ Object
21 22 23 24 |
# File 'lib/rex/json_hash_file.rb', line 21 def [](k) synced_update @hash[k] end |
#[]=(k, v) ⇒ Object
26 27 28 29 30 |
# File 'lib/rex/json_hash_file.rb', line 26 def []=(k,v) synced_update do @hash[k] = v end end |
#clear ⇒ Object
43 44 45 46 47 |
# File 'lib/rex/json_hash_file.rb', line 43 def clear synced_update do @hash.clear end end |
#delete(k) ⇒ Object
37 38 39 40 41 |
# File 'lib/rex/json_hash_file.rb', line 37 def delete(k) synced_update do @hash.delete(k) end end |
#keys ⇒ Object
32 33 34 35 |
# File 'lib/rex/json_hash_file.rb', line 32 def keys synced_update @hash.keys end |