Advertisement
Guest User

variable_set???

a guest
May 18th, 2012
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.76 KB | None | 0 0
  1. k@mail:~/craigslist$ ./img.rb
  2. ./img.rb:15:in `read_config': undefined method `variable_set' for ImgGen:Module (NoMethodError)
  3.     from ./img.rb:15:in `each'
  4.     from ./img.rb:15:in `read_config'
  5.     from ./img.rb:9:in `start'
  6.     from ./img.rb:22
  7. k@mail:~/craigslist$ cat img.rb
  8. #!/usr/bin/env ruby
  9.  
  10. %w[ rubygems RMagick yaml ].each{|l| require l  }
  11. include Magick
  12.  
  13. module ImgGen
  14.     class << self
  15.         def start()
  16.             read_config("img.yaml")
  17.             stripes = ImageList.new
  18.             puts "ohi #{width}"
  19.         end
  20.         def read_config(file)
  21.             c=YAML.load_file(file)
  22.             c["img"].each { |key, value| variable_set("#{key}", value) }
  23.         end
  24.     end
  25. end
  26. #canvas = Magick::Image.new(240, 300,
  27. #              Magick::HatchFill.new('white','lightcyan2'))
  28. #gc = Magick::Draw.new
  29. ImgGen.start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement