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 22 |
# File 'lib/luigi_projects_list.rb', line 12 def lookup_by_anything thing, value project_class = self[0].class raise "#{project_class} does not implement #{thing.to_s}()" unless project_class.instance_methods.include? thing raise "#{thing}" unless [:name, :date, :index].include? thing selection = self.map{|project| project if project.method(thing).call.to_s.downcase.include? value.to_s.downcase } selection.select{|p|p} end |
#lookup_by_date(date) ⇒ Object
28 29 30 |
# File 'lib/luigi_projects_list.rb', line 28 def lookup_by_date date self.lookup_by_anything :date, date end |
#lookup_by_index(index) ⇒ Object
24 25 26 |
# File 'lib/luigi_projects_list.rb', line 24 def lookup_by_index index self.lookup_by_anything :index, index end |
#lookup_by_name(name) ⇒ Object
32 33 34 |
# File 'lib/luigi_projects_list.rb', line 32 def lookup_by_name name self.lookup_by_anything :name, name end |