Class: Gluer::File
- Inherits:
-
Object
- Object
- Gluer::File
- Defined in:
- lib/gluer/file.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #add_registration(registration) ⇒ Object
-
#initialize(path) ⇒ File
constructor
A new instance of File.
- #reload ⇒ Object
- #touch ⇒ Object
- #touched? ⇒ Boolean
- #unload ⇒ Object
Constructor Details
#initialize(path) ⇒ File
Returns a new instance of File.
8 9 10 |
# File 'lib/gluer/file.rb', line 8 def initialize(path) @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/gluer/file.rb', line 6 def path @path end |
Instance Method Details
#add_registration(registration) ⇒ Object
20 21 22 23 |
# File 'lib/gluer/file.rb', line 20 def add_registration(registration) new_registration_pool.add(registration) touch end |
#reload ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/gluer/file.rb', line 30 def reload load_from_source if touched? registration_pool.rollback new_registration_pool.commit registration_pool.replace(new_registration_pool) new_registration_pool.clear end end |
#touch ⇒ Object
12 13 14 |
# File 'lib/gluer/file.rb', line 12 def touch @touched = true end |
#touched? ⇒ Boolean
16 17 18 |
# File 'lib/gluer/file.rb', line 16 def touched? !!@touched end |
#unload ⇒ Object
25 26 27 28 |
# File 'lib/gluer/file.rb', line 25 def unload registration_pool.rollback registration_pool.clear end |