Class: Array
Instance Method Summary collapse
Instance Method Details
#only_tags(*wanted_tags) ⇒ Object
16 17 18 19 20 |
# File 'lib/dooby/core_ext.rb', line 16 def (*) = '#' if .empty? = self.grep(/[#{}]./) .flatten end |
#only_tags!(*wanted_tags) ⇒ Object
12 13 14 |
# File 'lib/dooby/core_ext.rb', line 12 def (*) replace(()) end |
#tasks_by_tag(*tags) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/dooby/core_ext.rb', line 22 def tasks_by_tag(*) unless self.empty? tasks = [] items = self.dup .each do |tag| matches = items.grep(/#{tag}/) items = items - matches unless matches.empty? separator = "\n==================== #{tag[1..-1].upcase} ====================".white_on_red tasks << separator unless tasks.include? separator tasks << matches end end tasks.unshift items tasks.flatten else nil end end |