[#409331] Capture HTML table data, pass to Ruby, pass back and display result in HTML text field — Hubert Wagner <lists@...>

Hello :

11 messages 2013/08/04

[#409336] Rakefile Error - Please Help — "Jennifer T." <lists@...>

Hi,

13 messages 2013/08/04
[#409341] Re: Rakefile Error - Please Help — Hassan Schroeder <hassan.schroeder@...> 2013/08/04

On Sun, Aug 4, 2013 at 7:41 AM, Jennifer T. <lists@ruby-forum.com> wrote:

Creating variable inside a class

From: Renato Co <lists@...>
Date: 2013-08-05 20:35:54 UTC
List: ruby-talk #409374
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 `<main>': undefined method `data_dfp=' for
#<Nokogiri::XML::SAX::Parser:0x007fcc1413bea0> (NoMethodError)


Whats the right way of doing this?

-- 
Posted via http://www.ruby-forum.com/.

Thread

Prev Next

In This Thread

Prev Next