id:hsur にコメントでバグを指摘されたのでちょっと修正。 require 'yaml' require 'rubygems' require 'mechanize' require 'uri' require 'tempfile' class NicoVideo attr_reader :email, :password AGENT_ALIAS = 'Windows Mozilla' def initialize(*args) case args.length when 1 fname = args[0] raise unless File.exists?(fname) YAML.load_file(fname).each do |sym, value| instance_variable_set('@' + sym, value) end end @agent = WWW::Mec