lib/twitter_ebooks/model.rb in twitter_ebooks-2.3.1 vs lib/twitter_ebooks/model.rb in twitter_ebooks-2.3.2
- old
+ new
@@ -6,21 +6,25 @@
require 'digest/md5'
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)
File.open(path, 'wb') do |f|
f.write(Marshal.dump({