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



270
271
272
273
274
275
276
# File 'lib/sake.rb', line 270

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.



280
281
282
# File 'lib/sake.rb', line 280

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