#---
# Excerpted from "The ThoughtWorks Anthology",
# published by The Pragmatic Bookshelf.
# Copyrights apply to this code. It may not be used to create training material, 
# courses, books, articles, and the like. Contact us if you are in doubt.
# We make no guarantees that this code is fit for any purpose. 
# Visit http://www.pragmaticprogrammer.com/titles/twa for more book information.
#---
require 'model'

class RulesBuilder8
  def load aStream
    $config = Configuration.new
    eval(aStream.join("\n"))
    return $config
  end
end


def item name
  $current_item = Item.new(name)
  $config.add_item $current_item
end

def uses resource
  $current_item.add_usage(resource)
end


def acid
  $current_acid = Acid.new
end
def acid_type type
  $current_acid.type = type
end

def acid_grade grade
  $current_acid.grade = grade
end

def provides resource
  $current_item.add_provision(resource)
end

def depends supplier
  $current_item.add_dependency($config[supplier])
end



def electricity power
  return  Electricity.new(power)
end
