From: Renato Co Date: 2013-08-06T05:35:54+09:00 Subject: Creating variable inside a class All I want to do, is to create a new variable called data_dfp inside the class, and be able to set/get it's value from outside require 'nokogiri' class MyDocument < Nokogiri::XML::SAX::Document attr_accessor :data_dfp def start_element(name, attrs = []) puts "#{name}" end end parser = Nokogiri::XML::SAX::Parser.new(MyDocument.new) parser.data_dfp = 4 puts parser.data_dfp Error nokoteste.rb:12:in `
': undefined method `data_dfp=' for # (NoMethodError) Whats the right way of doing this? -- Posted via http://www.ruby-forum.com/.