Navigation Menu

Skip to content

Commit

Permalink
Merge branch 'master' of http://github.com/robashton/TwitterFS
Browse files Browse the repository at this point in the history
  • Loading branch information
jhollingworth committed Jun 12, 2010
2 parents 308929f + 08a0ead commit 2156dfe
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 62 deletions.
65 changes: 53 additions & 12 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 0 additions & 50 deletions twitterfs.rb
Expand Up @@ -38,53 +38,3 @@ def initialize(name, data)
end
end

class FileSystem

attr :root

def initialize(persister)
@persister = persister
@root = Directory.new(nil, "root")
end
end

class Persister

def initialize()
@tweets = Array.new
end

def add_tweet(tweet, annotation)
newtweet = Tweet.new(nil, tweet, annotation)
@tweets.push(newtweet)
newtweet.set_id(@tweets.length-1)
newtweet.id
end

def get_tweet(id)
tweet = @tweets[id]
end

def get_most_recent_tweet()
tweet = @tweets[@tweets.length-1]
end
end

class Tweet

attr :annotation, :id, :content

attr :annotation
attr_writer :id
attr_writer :content

def initialize(id, content, annotation)
@annotation = annotation
@id = id
@content = content
end

def set_id(id)
@id = id
end
end
1 change: 1 addition & 0 deletions twitterfs_persistance_tests.rb
@@ -1,4 +1,5 @@
require 'twitterfs'
require 'twitterfspersistance'

class MockPersister
def initialize
Expand Down
52 changes: 52 additions & 0 deletions twitterfspersistance.rb
@@ -0,0 +1,52 @@
require 'twitterfs'

class FileSystem

attr :root

def initialize(persister)
@persister = persister
@root = Directory.new(nil, "root")
end
end

class Persister

def initialize()
@tweets = Array.new
end

def add_tweet(tweet, annotation)
newtweet = Tweet.new(nil, tweet, annotation)
@tweets.push(newtweet)
newtweet.set_id(@tweets.length-1)
newtweet.id
end

def get_tweet(id)
tweet = @tweets[id]
end

def get_most_recent_tweet()
tweet = @tweets[@tweets.length-1]
end
end

class Tweet

attr :annotation, :id, :content

attr :annotation
attr_writer :id
attr_writer :content

def initialize(id, content, annotation)
@annotation = annotation
@id = id
@content = content
end

def set_id(id)
@id = id
end
end

0 comments on commit 2156dfe

Please sign in to comment.