From 302ea0229d581ecd48dcfbd12cda83e221129eba Mon Sep 17 00:00:00 2001 From: Jaiden Mispy <^_^@mispy.me> Date: Sat, 25 Oct 2014 05:48:13 -0700 Subject: [PATCH] grr stupid mistake --- lib/twitter_ebooks/model.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/twitter_ebooks/model.rb b/lib/twitter_ebooks/model.rb index e7b6958..b463d36 100644 --- a/lib/twitter_ebooks/model.rb +++ b/lib/twitter_ebooks/model.rb @@ -8,18 +8,22 @@ require 'csv' module Ebooks class Model - attr_accessor :hash, :sentences, :mentions, :keywords + attr_accessor :hash, :tokens, :sentences, :mentions, :keywords def self.consume(txtpath) Model.new.consume(txtpath) end def self.load(path) - props = Marshal.load(File.open(path, 'rb') { |f| f.read }) - @tokens = props[:tokens] - @sentences = props[:sentences] - @mentions = props[:mentions] - @keywords = props[:keywords] + model = Model.new + model.instance_eval do + props = Marshal.load(File.open(path, 'rb') { |f| f.read }) + @tokens = props[:tokens] + @sentences = props[:sentences] + @mentions = props[:mentions] + @keywords = props[:keywords] + end + model end def save(path)