Class: Needy::IChat

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir, target) ⇒ IChat

Returns a new instance of IChat.



107
108
109
110
# File 'lib/needy.rb', line 107

def initialize dir, target
  self.dir = dir
  self.target = target
end

Instance Attribute Details

#dirObject

Returns the value of attribute dir.



105
106
107
# File 'lib/needy.rb', line 105

def dir
  @dir
end

#targetObject

Returns the value of attribute target.



105
106
107
# File 'lib/needy.rb', line 105

def target
  @target
end

Instance Method Details

#chatter(abbrev, name) ⇒ Object



123
124
125
# File 'lib/needy.rb', line 123

def chatter abbrev, name
  target.thr { target.set abbrev, self.when(name) }
end

#when(name) ⇒ Object



112
113
114
115
116
117
118
119
120
121
# File 'lib/needy.rb', line 112

def when name
  Dir["#{dir}/*"].sort.reverse.each do |dir|
    Dir["#{dir}/*.ichat"].each do |path|
      if path =~ /\/#{name} on /
        return File.mtime(path)
      end
    end
  end
  return Time.at(0)
end