Class: Enumark

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/enumark.rb,
lib/enumark/version.rb

Defined Under Namespace

Classes: Category, Item

Constant Summary collapse

CATEGORY_START =
/^\s.*<DT><H3/
CATEGORY_END =
/^\s.*<\/DL><p>/
CATEGORY_NAME =
/ADD_DATE="(.*?)".*LAST_MODIFIED="(.*?)".*>(.*)<\/H3/
ITEM_PREFIX =
/^\s.*<DT><A/
ITEM_NAME =
/HREF="(.*?)".*ADD_DATE="(.*?)".*>(.*)<\/A>/
VERSION =
"0.1.0"

Instance Method Summary collapse

Constructor Details

#initialize(file) ⇒ Enumark



48
49
50
51
52
53
# File 'lib/enumark.rb', line 48

def initialize(file)
  @file = file
  @lock = Mutex.new
  @read = false
  @items = []
end

Instance Method Details

#eachObject



55
56
57
58
59
60
# File 'lib/enumark.rb', line 55

def each
  return self unless block_given?

  read_all_lines
  @items.each { |item| yield item }
end