Class: LuigiProjectsList
- Inherits:
-
Array
- Object
- Array
- LuigiProjectsList
- Defined in:
- lib/luigi_projects_list.rb
Instance Method Summary collapse
- #lookup_by_anything(thing, value) ⇒ Object
- #lookup_by_date(date) ⇒ Object
- #lookup_by_index(index) ⇒ Object
- #lookup_by_name(name) ⇒ Object
Instance Method Details
#lookup_by_anything(thing, value) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/luigi_projects_list.rb', line 12 def lookup_by_anything thing, value raise "#{thing}" unless [:name, :date, :index].include? thing selection = self.map{|project| if project.methods.include? thing and project.method(thing).call.to_s.downcase.include? value.to_s.downcase project end } selection.select{|p|p} end |
#lookup_by_date(date) ⇒ Object
27 28 29 |
# File 'lib/luigi_projects_list.rb', line 27 def lookup_by_date date self.lookup_by_anything :date, date end |
#lookup_by_index(index) ⇒ Object
23 24 25 |
# File 'lib/luigi_projects_list.rb', line 23 def lookup_by_index index self.lookup_by_anything :index, index end |
#lookup_by_name(name) ⇒ Object
31 32 33 |
# File 'lib/luigi_projects_list.rb', line 31 def lookup_by_name name self.lookup_by_anything :name, name end |