Class: Lh::Project

Inherits:
Object show all
Defined in:
lib/lh.rb

Class Method Summary collapse

Class Method Details

.id_from_input(input, projects) ⇒ Object



163
164
165
166
167
168
169
170
# File 'lib/lh.rb', line 163

def self.id_from_input(input, projects)
  id = projects.map {|project|
    if input.is_i? then project[:id] if input.to_i == project[:id]
    else project[:id] if input == project[:name] end
  }
  raise "Project '#{input}' not found. Try again." if id.nil?
  id[0]
end

.return_all_filteredObject



155
156
157
158
159
160
161
# File 'lib/lh.rb', line 155

def self.return_all_filtered
  projects_raw = ::Lighthouse::Project.find(:all)
  projects_raw.map {|project|
    { name: project.name,
      id:   project.id }
  }
end