Class: Sake::TasksArray

Inherits:
Array
  • Object
show all
Defined in:
lib/sake.rb

Overview

Lets us do:

tasks = TasksFile.parse('Rakefile').tasks
task  = tasks['db:remigrate']

Instance Method Summary collapse

Instance Method Details

#[](name_or_index) ⇒ Object

Accepts a task name or index.



292
293
294
295
296
297
298
# File 'lib/sake.rb', line 292

def [](name_or_index)
  if name_or_index.is_a? String
    detect { |task| task.name == name_or_index }
  else
    super
  end
end

#to_rubyObject

The source of all these tasks.



302
303
304
# File 'lib/sake.rb', line 302

def to_ruby
  map { |task| task.to_ruby }.join("\n")
end