Class: Enumark
- Inherits:
-
Object
show all
- Includes:
- Enumerable
- Defined in:
- lib/enumark.rb,
lib/enumark/dir.rb,
lib/enumark/item.rb,
lib/enumark/config.rb,
lib/enumark/version.rb,
lib/enumark/category.rb,
lib/enumark/grouping.rb
Defined Under Namespace
Modules: Config
Classes: Category, Dir, Grouping, Item
Constant Summary
collapse
- VERSION =
"1.1.1"
Instance Method Summary
collapse
Constructor Details
#initialize(file, items: nil) ⇒ Enumark
Returns a new instance of Enumark.
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/enumark.rb', line 14
def initialize(file, items: nil)
@file = file
@lock = Mutex.new
@items = items
@hosts = Grouping.new(self, :host)
@dup_titles = Grouping.new(self, :name){ |groups| groups.select{ |_, items| items.count > 1 } }
@dup_hrefs = Grouping.new(self, :href){ |groups| groups.select{ |_, items| items.count > 1 } }
@cates = Grouping.new(self, :categories_str)
end
|
Instance Method Details
#each(&block) ⇒ Object
25
26
27
28
29
|
# File 'lib/enumark.rb', line 25
def each(&block)
read_all_lines
sort_by_add_date!
@items.each(&block)
end
|
#each_category(&block) ⇒ Object
43
44
45
|
# File 'lib/enumark.rb', line 43
def each_category(&block)
@cates.each(&block)
end
|
#each_dup_href(&block) ⇒ Object
39
40
41
|
# File 'lib/enumark.rb', line 39
def each_dup_href(&block)
@dup_hrefs.each(&block)
end
|
#each_dup_title(&block) ⇒ Object
35
36
37
|
# File 'lib/enumark.rb', line 35
def each_dup_title(&block)
@dup_titles.each(&block)
end
|
#each_host(&block) ⇒ Object
31
32
33
|
# File 'lib/enumark.rb', line 31
def each_host(&block)
@hosts.each(&block)
end
|