stash 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ext/stash/build.c +267 -0
- data/ext/stash/execute.c +248 -0
- data/ext/stash/extconf.rb +3 -0
- data/ext/stash/intern.h +79 -0
- data/ext/stash/lex.yy.c +2143 -0
- data/ext/stash/lex.yy.h +333 -0
- data/ext/stash/mustache.c +50 -0
- data/ext/stash/mustache.h +124 -0
- data/ext/stash/optimize.c +208 -0
- data/ext/stash/stash.c +177 -0
- data/ext/stash/stash.h +17 -0
- data/ext/stash/tokens.c +151 -0
- data/ext/stash/types.c +181 -0
- data/lib/stash.rb +2 -34
- data/lib/stash/debug.rb +46 -0
- metadata +30 -88
- data/.document +0 -5
- data/LICENSE +0 -20
- data/README.markdown +0 -92
- data/Rakefile +0 -46
- data/VERSION +0 -1
- data/lib/stash/class_methods.rb +0 -59
- data/lib/stash/hash.rb +0 -62
- data/lib/stash/list.rb +0 -91
- data/lib/stash/redis_adapter.rb +0 -152
- data/lib/stash/string.rb +0 -16
- data/spec/hash_spec.rb +0 -29
- data/spec/list_spec.rb +0 -65
- data/spec/spec.opts +0 -1
- data/spec/spec_helper.rb +0 -12
- data/spec/string_spec.rb +0 -9
- data/stash.gemspec +0 -68
data/lib/stash/string.rb
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
# Strings are Stash's most basic type, and the only non-collection type
|
2
|
-
# They store exactly that, a string, and nothing more
|
3
|
-
class Stash::String
|
4
|
-
def initialize(key, adapter = Stash.default.adapter)
|
5
|
-
@key, @adapter = key.to_s, adapter
|
6
|
-
end
|
7
|
-
|
8
|
-
def to_string
|
9
|
-
@adapter.get @key
|
10
|
-
end
|
11
|
-
alias_method :to_s, :to_string
|
12
|
-
|
13
|
-
def inspect
|
14
|
-
"#<Stash::String[:#{@key}]: #{to_s}>"
|
15
|
-
end
|
16
|
-
end
|
data/spec/hash_spec.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe Stash::Hash do
|
4
|
-
before :each do
|
5
|
-
@hash = Stash::Hash[:foobar]
|
6
|
-
@hash.clear
|
7
|
-
end
|
8
|
-
|
9
|
-
it "clears hashes" do
|
10
|
-
@hash[:foo] = "a"
|
11
|
-
@hash[:bar] = "b"
|
12
|
-
@hash.clear
|
13
|
-
@hash.to_hash.should == {}
|
14
|
-
end
|
15
|
-
|
16
|
-
it "sets and gets strings from hashes" do
|
17
|
-
@hash[:foo].should be_nil
|
18
|
-
@hash[:foo] = "42"
|
19
|
-
@hash[:foo].should == "42"
|
20
|
-
end
|
21
|
-
|
22
|
-
it "casts to a Ruby hash" do
|
23
|
-
@hash.should be_empty
|
24
|
-
@hash['foo'] = 'a'
|
25
|
-
@hash['bar'] = 'b'
|
26
|
-
|
27
|
-
@hash.to_hash.should == {'foo'=>'a', 'bar'=>'b'}
|
28
|
-
end
|
29
|
-
end
|
data/spec/list_spec.rb
DELETED
@@ -1,65 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
-
|
3
|
-
describe Stash::List do
|
4
|
-
before :each do
|
5
|
-
@list = Stash::List[:foobar]
|
6
|
-
@list.clear
|
7
|
-
end
|
8
|
-
|
9
|
-
it "clears lists" do
|
10
|
-
@list << "x"
|
11
|
-
@list << "y"
|
12
|
-
@list << "z"
|
13
|
-
@list.clear
|
14
|
-
@list.to_a.should == []
|
15
|
-
end
|
16
|
-
|
17
|
-
it "pushes to lists" do
|
18
|
-
# Normal syntax
|
19
|
-
@list.push "zomg"
|
20
|
-
|
21
|
-
# Cool syntax
|
22
|
-
@list << "wtf"
|
23
|
-
|
24
|
-
@list.to_a.should == ["zomg", "wtf"]
|
25
|
-
end
|
26
|
-
|
27
|
-
it "unshifts to lists" do
|
28
|
-
@list.unshift "omfg"
|
29
|
-
@list.unshift "lulz"
|
30
|
-
|
31
|
-
@list.to_a.should == ["lulz", "omfg"]
|
32
|
-
end
|
33
|
-
|
34
|
-
it "pops from lists" do
|
35
|
-
@list << "x"
|
36
|
-
@list << "y"
|
37
|
-
@list << "z"
|
38
|
-
@list.pop.should == "z"
|
39
|
-
@list.to_a.should == ["x", "y"]
|
40
|
-
end
|
41
|
-
|
42
|
-
it "shifts from lists" do
|
43
|
-
@list << "x"
|
44
|
-
@list << "y"
|
45
|
-
@list << "z"
|
46
|
-
@list.shift.should == "x"
|
47
|
-
@list.to_a.should == ["y", "z"]
|
48
|
-
end
|
49
|
-
|
50
|
-
it "knows its length" do
|
51
|
-
@list.length.should == 0
|
52
|
-
|
53
|
-
@list << "x"
|
54
|
-
@list << "y"
|
55
|
-
@list << "z"
|
56
|
-
@list.length.should == 3
|
57
|
-
end
|
58
|
-
|
59
|
-
it "knows if it's empty" do
|
60
|
-
@list.should be_empty
|
61
|
-
|
62
|
-
@list << "something"
|
63
|
-
@list.should_not be_empty
|
64
|
-
end
|
65
|
-
end
|
data/spec/spec.opts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/spec/spec_helper.rb
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.dirname(__FILE__)
|
2
|
-
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
-
|
4
|
-
require 'stash'
|
5
|
-
require 'rspec'
|
6
|
-
require 'rspec/autorun'
|
7
|
-
|
8
|
-
# Connect to Redis
|
9
|
-
Stash.setup :default, :adapter => :redis,
|
10
|
-
:namespace => 'stash_test',
|
11
|
-
:host => '127.0.0.1',
|
12
|
-
:port => 6379
|
data/spec/string_spec.rb
DELETED
data/stash.gemspec
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{stash}
|
8
|
-
s.version = "1.0.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Tony Arcieri"]
|
12
|
-
s.date = %q{2010-12-07}
|
13
|
-
s.description = %q{Stash maps the facilities provided by data structures servers onto classes which mimic Ruby's built-in types}
|
14
|
-
s.email = %q{tony@medioh.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.markdown"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"LICENSE",
|
22
|
-
"README.markdown",
|
23
|
-
"Rakefile",
|
24
|
-
"VERSION",
|
25
|
-
"lib/stash.rb",
|
26
|
-
"lib/stash/class_methods.rb",
|
27
|
-
"lib/stash/hash.rb",
|
28
|
-
"lib/stash/list.rb",
|
29
|
-
"lib/stash/redis_adapter.rb",
|
30
|
-
"lib/stash/string.rb",
|
31
|
-
"spec/hash_spec.rb",
|
32
|
-
"spec/list_spec.rb",
|
33
|
-
"spec/spec.opts",
|
34
|
-
"spec/spec_helper.rb",
|
35
|
-
"spec/string_spec.rb",
|
36
|
-
"stash.gemspec"
|
37
|
-
]
|
38
|
-
s.homepage = %q{http://github.com/tarcieri/stash}
|
39
|
-
s.require_paths = ["lib"]
|
40
|
-
s.rubygems_version = %q{1.3.7}
|
41
|
-
s.summary = %q{Abstract interface to data structures servers}
|
42
|
-
s.test_files = [
|
43
|
-
"spec/hash_spec.rb",
|
44
|
-
"spec/list_spec.rb",
|
45
|
-
"spec/spec_helper.rb",
|
46
|
-
"spec/string_spec.rb"
|
47
|
-
]
|
48
|
-
|
49
|
-
if s.respond_to? :specification_version then
|
50
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
51
|
-
s.specification_version = 3
|
52
|
-
|
53
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
54
|
-
s.add_runtime_dependency(%q<redis>, ["~> 2.1.0"])
|
55
|
-
s.add_runtime_dependency(%q<redis-namespace>, ["~> 0.10.0"])
|
56
|
-
s.add_development_dependency(%q<rspec>, [">= 2.2.0"])
|
57
|
-
else
|
58
|
-
s.add_dependency(%q<redis>, ["~> 2.1.0"])
|
59
|
-
s.add_dependency(%q<redis-namespace>, ["~> 0.10.0"])
|
60
|
-
s.add_dependency(%q<rspec>, [">= 2.2.0"])
|
61
|
-
end
|
62
|
-
else
|
63
|
-
s.add_dependency(%q<redis>, ["~> 2.1.0"])
|
64
|
-
s.add_dependency(%q<redis-namespace>, ["~> 0.10.0"])
|
65
|
-
s.add_dependency(%q<rspec>, [">= 2.2.0"])
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|