Class: Link

Inherits:
Object
  • Object
show all
Defined in:
lib/cinch/plugins/links-logger/link.rb

Overview

Class to track Link data

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nick, url, time = Time.now) ⇒ Link

Returns a new instance of Link.



6
7
8
9
10
11
12
# File 'lib/cinch/plugins/links-logger/link.rb', line 6

def initialize(nick, url, time = Time.now)
  @nick = nick
  @title = Cinch::Toolbox.get_page_title(url)
  @count = 0
  @short_url = Cinch::Toolbox.shorten(url)
  @time = time
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



4
5
6
# File 'lib/cinch/plugins/links-logger/link.rb', line 4

def count
  @count
end

#nickObject

Returns the value of attribute nick.



4
5
6
# File 'lib/cinch/plugins/links-logger/link.rb', line 4

def nick
  @nick
end

#short_urlObject

Returns the value of attribute short_url.



4
5
6
# File 'lib/cinch/plugins/links-logger/link.rb', line 4

def short_url
  @short_url
end

#timeObject

Returns the value of attribute time.



4
5
6
# File 'lib/cinch/plugins/links-logger/link.rb', line 4

def time
  @time
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/cinch/plugins/links-logger/link.rb', line 4

def title
  @title
end

Instance Method Details

#inc_count(count = 1) ⇒ Object



14
15
16
# File 'lib/cinch/plugins/links-logger/link.rb', line 14

def inc_count(count = 1)
  @count += count
end