Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

First push to github

  • Loading branch information...
commit 7d9ca55b9a38ba5686da1ed06d6fede79b56511e 1 parent d68266f
@samdunne authored
View
3  Gemfile
@@ -0,0 +1,3 @@
+source "http://rubygems.org"
+
+gemspec
View
26 Gemfile.lock
@@ -0,0 +1,26 @@
+PATH
+ remote: .
+ specs:
+ rdata (0.0.1)
+
+GEM
+ remote: http://rubygems.org/
+ specs:
+ diff-lcs (1.1.3)
+ rake (10.0.2)
+ rspec (2.12.0)
+ rspec-core (~> 2.12.0)
+ rspec-expectations (~> 2.12.0)
+ rspec-mocks (~> 2.12.0)
+ rspec-core (2.12.0)
+ rspec-expectations (2.12.0)
+ diff-lcs (~> 1.1.3)
+ rspec-mocks (2.12.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ rake
+ rdata!
+ rspec
View
11 README.md
@@ -1,4 +1,9 @@
-ruby-datastructures
-===================
+# RData
-Datastructures in Ruby
+## Installation
+
+ gem install rdata
+
+## Usage
+
+ require 'rdata'
View
9 lib/rdata.rb
@@ -1 +1,8 @@
-require "rdata/stack.rb"
+require 'rdata/version'
+require "rdata/stack.rb"
+
+module RData
+ def self.Stack
+ Stack.new
+ end
+end
View
12 lib/rdata/stack.rb
@@ -3,20 +3,20 @@ module RData
class Stack
def initialize
- @selfStack = Array.extract([
+ @selfStack = Array[
:top,
- :push,
- :pop,
:size,
:clear,
:inspect,
:to_s
- ])
+ ]
+
+ @selfStack[0] = :top
end
def push(x)
- @selfStack[:top] = selfStack[:top] + 1
- @selfStack[selfStack[:top]] = x
+ @selfStack[:top] = @selfStack[:top] + 1
+ @selfStack[@selfStack[:top]] = x
end
def top
View
3  lib/rdata/version.rb
@@ -0,0 +1,3 @@
+module RData
+ VERSION = "0.0.1"
+end
View
9 spec/rdata_spec.rb
@@ -0,0 +1,9 @@
+require 'spec_helper'
+
+describe RData do
+ it "should return data for a stack" do
+ element_data = RData.Stack
+ #element_data.should be_nil
+ element_data.push(1).should == 1
+ end
+end
View
1  spec/spec_helper.rb
@@ -0,0 +1 @@
+require 'rdata'
View
0  version
No changes.
Please sign in to comment.
Something went wrong with that request. Please try again.