class Enumark::Item
Constants
- PATTERN
- PREFIX
- USELESS_SHARP
Attributes
add_date[R]
categories[R]
href[R]
name[R]
Public Class Methods
new(line, categories)
click to toggle source
# File lib/enumark/item.rb, line 12 def initialize(line, categories) m = line.match(PATTERN) @href = m[1].gsub(USELESS_SHARP, '') @add_date = Time.at(m[2].to_i) @name = m[3] @categories = categories end
Public Instance Methods
categories_str()
click to toggle source
# File lib/enumark/item.rb, line 24 def categories_str @categories_str ||= "/#{categories.join('/')}" end
eql?(another)
click to toggle source
# File lib/enumark/item.rb, line 36 def eql?(another) href.eql?(another.href) end
hash()
click to toggle source
# File lib/enumark/item.rb, line 32 def hash href.hash end
host()
click to toggle source
# File lib/enumark/item.rb, line 40 def host @host ||= (URI.parse(href).host rescue 'unknown') end
inspect()
click to toggle source
# File lib/enumark/item.rb, line 20 def inspect @inspect ||= "#{add_date.strftime('%F %T')} #{categories_str}> #{name}" end
to_s()
click to toggle source
# File lib/enumark/item.rb, line 28 def to_s inspect end