Sha256: 9d45fd86c37e10a6dd9cc3fb6fa74a29821b5789edc1d43eae343f5fa1867dae

Contents?: true

Size: 621 Bytes

Versions: 2

Compression:

Stored size: 621 Bytes

Contents

class Metalive::Chain

  attr_reader :updaters

  def initialize
    @updaters = []
  end

  def add(updater, options = {})
    updater = create(updater, options) unless updater.respond_to?(:update)
    updaters << updater
    self
  end

  def create(updater, options = {})
    updater = Metalive.const_get(updater.to_s.capitalize) if String === updater or Symbol === updater
    updater.new options
  end

  def method_missing(name, *arguments, &block)
    add name, arguments.first
  end
  
  def update(metadata)
    not updaters.collect do |updater|
      updater.update(metadata)
    end.include?(false)
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metalive-0.0.2 lib/metalive/chain.rb
metalive-0.0.1 lib/metalive/chain.rb