From: Luc Evers Date: 2007-11-24T04:05:37+09:00 Subject: Re: Array object but to_a is needed to access data Ron Fox wrote: > Works for me once I clean up the issues in your paste.. specifically: > This nonsense: > > > endclass Filter > > include State > > end > > towards the end of the State module def.. at least I hope these are > paste errors. > > Ron. Ron, Yes, these are paste faults. I'll send the complete tail.rb + below the state.rb And the program works but can you tell me the (filter.hash[:action].to_a[0]) the to_a need? tail.rb in attach state.rb ==> module State attr_reader :hash, :action def initialize @hash = Hash.new @action = Array.new end def chkurg(line) case line when /%FAN-3-FAN_FAILED/ @action << 'urgent' << 'mail' << 'sms' @hash[:alarm] = 'testurgent' @hash[:action] = @action when /CONTROLLER-2-FIRMWARE/ action << 'urgent' << 'mail' << 'sms' @hash = { :alarm => 'urgent', :action => @action } else "noState" end end end Attachments: http://www.ruby-forum.com/attachment/1028/tail.rb -- Posted via http://www.ruby-forum.com/.