Class: FileWatch::Watch::WatchedFile

Inherits:
Object
  • Object
show all
Defined in:
lib/filewatch/watch.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, inode, initial) ⇒ WatchedFile

Returns a new instance of WatchedFile.



22
23
24
25
26
# File 'lib/filewatch/watch.rb', line 22

def initialize(path, inode, initial)
  @path = path
  @size, @create_sent, @timeout_sent = 0, false, false
  @inode, @initial = inode, initial
end

Instance Attribute Details

#create_sent=(value) ⇒ Object (writeonly)

Sets the attribute create_sent

Parameters:

  • value

    the value to set the attribute create_sent to.



18
19
20
# File 'lib/filewatch/watch.rb', line 18

def create_sent=(value)
  @create_sent = value
end

#initial=(value) ⇒ Object (writeonly)

Sets the attribute initial

Parameters:

  • value

    the value to set the attribute initial to.



18
19
20
# File 'lib/filewatch/watch.rb', line 18

def initial=(value)
  @initial = value
end

#inodeObject (readonly)

Returns the value of attribute inode.



17
18
19
# File 'lib/filewatch/watch.rb', line 17

def inode
  @inode
end

#pathObject (readonly)

Returns the value of attribute path.



20
21
22
# File 'lib/filewatch/watch.rb', line 20

def path
  @path
end

#sizeObject (readonly)

Returns the value of attribute size.



17
18
19
# File 'lib/filewatch/watch.rb', line 17

def size
  @size
end

#timeout_sent=(value) ⇒ Object (writeonly)

Sets the attribute timeout_sent

Parameters:

  • value

    the value to set the attribute timeout_sent to.



18
19
20
# File 'lib/filewatch/watch.rb', line 18

def timeout_sent=(value)
  @timeout_sent = value
end

Class Method Details

.new_initial(path, inode) ⇒ Object



9
10
11
# File 'lib/filewatch/watch.rb', line 9

def self.new_initial(path, inode)
  new(path, inode, true)
end

.new_ongoing(path, inode) ⇒ Object



13
14
15
# File 'lib/filewatch/watch.rb', line 13

def self.new_ongoing(path, inode)
  new(path, inode, false)
end

Instance Method Details

#clear_timeoutObject



33
34
35
# File 'lib/filewatch/watch.rb', line 33

def clear_timeout
  @timeout_sent = false
end

#create_sent?Boolean

Returns:

  • (Boolean)


37
38
39
# File 'lib/filewatch/watch.rb', line 37

def create_sent?
  @create_sent
end

#initial?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/filewatch/watch.rb', line 41

def initial?
  @initial
end

#timeout_sent?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/filewatch/watch.rb', line 45

def timeout_sent?
  @timeout_sent
end

#to_sObject



49
# File 'lib/filewatch/watch.rb', line 49

def to_s() inspect; end

#update(stat, inode = nil) ⇒ Object



28
29
30
31
# File 'lib/filewatch/watch.rb', line 28

def update(stat, inode = nil)
  @size = stat.size
  @inode = inode if inode
end