Class: Filetter::FileInfo
- Inherits:
-
Object
- Object
- Filetter::FileInfo
- Defined in:
- lib/filetter/file_info.rb
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#pathname ⇒ Object
readonly
Returns the value of attribute pathname.
Instance Method Summary collapse
- #check_modified ⇒ Object
-
#initialize(pathname, observe_targets = [:mtime]) ⇒ FileInfo
constructor
A new instance of FileInfo.
Constructor Details
#initialize(pathname, observe_targets = [:mtime]) ⇒ FileInfo
Returns a new instance of FileInfo.
7 8 9 10 11 12 13 |
# File 'lib/filetter/file_info.rb', line 7 def initialize(pathname, observe_targets = [:mtime]) @changes = [] @pathname = pathname @targets = {} @observe_targets = observe_targets update_status() end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
5 6 7 |
# File 'lib/filetter/file_info.rb', line 5 def changes @changes end |
#pathname ⇒ Object (readonly)
Returns the value of attribute pathname.
5 6 7 |
# File 'lib/filetter/file_info.rb', line 5 def pathname @pathname end |
Instance Method Details
#check_modified ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/filetter/file_info.rb', line 15 def check_modified old = @targets.dup update_status() @changes = [] @targets.each do |k, v| @changes << k unless old[k] == v end end |