Sha256: 76249145cf8b920fb5e0259d9dc4d66c2ee69e9beb1ce8317b58556f599423e6

Contents?: true

Size: 538 Bytes

Versions: 31

Compression:

Stored size: 538 Bytes

Contents

require 'thor/ordered_hash'
require 'thor/task'

class Thor::TaskHash < Thor::OrderedHash
  def initialize(klass)
    super()
    @klass = klass
  end

  def each(local = false, &block)
    super() { |k, t| yield k, t.with_klass(@klass) }
    @klass.superclass.tasks.each { |k, t| yield k, t.with_klass(@klass) } unless local || @klass == Thor
  end

  def [](name)
    if task = super(name) || (@klass == Thor && @klass.superclass.tasks[name])
      return task.with_klass(@klass)
    end

    Thor::Task.dynamic(name, @klass)
  end
end

Version data entries

31 entries across 31 versions & 7 rubygems

Version Path
jherdman-thor-0.9.5 lib/thor/task_hash.rb
mislav-thor-0.9.10 lib/thor/task_hash.rb
mislav-thor-0.9.5 lib/thor/task_hash.rb
sproutit-sproutcore-1.0.0.20090408130025 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.0.20090416161445 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.0.20090720093355 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.0.20090720202429 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.0.20090721125122 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.126 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.20090721145251 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.20090721145280 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.20090721145281 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.20090721145282 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.20090721145285 lib/thor/lib/thor/task_hash.rb
sproutit-sproutcore-1.0.203 lib/thor/lib/thor/task_hash.rb
wycats-thor-0.9.5 lib/thor/task_hash.rb
wycats-thor-0.9.6 lib/thor/task_hash.rb
wycats-thor-0.9.7 lib/thor/task_hash.rb
wycats-thor-0.9.8 lib/thor/task_hash.rb
merb-core-1.1.3 spec10/public/webrat/test_app/gems/gems/thor-0.9.8/lib/thor/task_hash.rb