fauxsql 0.0.0 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/fauxsql/attribute_list.rb +5 -1
- data/lib/fauxsql/attribute_map.rb +1 -13
- data/lib/fauxsql/dereferenced_attribute.rb +2 -7
- data/lib/fauxsql/dsl.rb +18 -18
- data/test/test_fauxsql.rb +1 -1
- metadata +3 -4
- data/fauxsql.gemspec +0 -68
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.1.0
|
@@ -15,18 +15,6 @@ module Fauxsql
|
|
15
15
|
def [] key
|
16
16
|
real_key = Fauxsql.dereference_fauxsql_attribute(key)
|
17
17
|
Fauxsql.resolve_fauxsql_attribute super(real_key.hash)
|
18
|
-
end
|
19
|
-
|
20
|
-
# VERY VERY SPECIFIC to the marshal dump format.
|
21
|
-
# Probably brittle.
|
22
|
-
def keys
|
23
|
-
super.map do |key|
|
24
|
-
if key.match(/^.+Fauxsql::DereferencedAttribute.+@klass.+@lookup_key.+$/)
|
25
|
-
Fauxsql::DereferencedAttribute.load(key)
|
26
|
-
else
|
27
|
-
key
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
18
|
+
end
|
31
19
|
end
|
32
20
|
end
|
data/lib/fauxsql/dsl.rb
CHANGED
@@ -11,31 +11,31 @@ module Fauxsql
|
|
11
11
|
# set_fauxsql_attribute(:power, value)
|
12
12
|
# end
|
13
13
|
def attribute(attribute_name)
|
14
|
-
class_eval <<EORUBY
|
15
|
-
def #{attribute_name}
|
16
|
-
get_fauxsql_attribute(:#{attribute_name})
|
17
|
-
end
|
14
|
+
class_eval <<EORUBY
|
15
|
+
def #{attribute_name}
|
16
|
+
get_fauxsql_attribute(:#{attribute_name})
|
17
|
+
end
|
18
18
|
|
19
|
-
def #{attribute_name}=(value)
|
20
|
-
set_fauxsql_attribute(:#{attribute_name}, value)
|
21
|
-
end
|
19
|
+
def #{attribute_name}=(value)
|
20
|
+
set_fauxsql_attribute(:#{attribute_name}, value)
|
21
|
+
end
|
22
22
|
EORUBY
|
23
23
|
end
|
24
24
|
|
25
|
-
# DSL method to define a named Fauxsql list
|
25
|
+
# DSL method to define a named Fauxsql list
|
26
26
|
#
|
27
27
|
# calling with 'squad_members' is like writing:
|
28
28
|
# def squad_members
|
29
29
|
# get_fauxsql_list(:squad_members)
|
30
|
-
# end
|
30
|
+
# end
|
31
31
|
def list(attribute_name)
|
32
|
-
class_eval <<EORUBY
|
33
|
-
def #{attribute_name}
|
34
|
-
get_fauxsql_list(:#{attribute_name})
|
35
|
-
end
|
32
|
+
class_eval <<EORUBY
|
33
|
+
def #{attribute_name}
|
34
|
+
get_fauxsql_list(:#{attribute_name})
|
35
|
+
end
|
36
36
|
EORUBY
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
# DSL method to define a named Fauxsql map
|
40
40
|
#
|
41
41
|
# calling with 'mitigates' is like writing:
|
@@ -43,10 +43,10 @@ EORUBY
|
|
43
43
|
# get_fauxsql_map(:mitigates)
|
44
44
|
# end
|
45
45
|
def map(attribute_name)
|
46
|
-
class_eval <<EORUBY
|
47
|
-
def #{attribute_name}
|
48
|
-
get_fauxsql_map(:#{attribute_name})
|
49
|
-
end
|
46
|
+
class_eval <<EORUBY
|
47
|
+
def #{attribute_name}
|
48
|
+
get_fauxsql_map(:#{attribute_name})
|
49
|
+
end
|
50
50
|
EORUBY
|
51
51
|
end
|
52
52
|
end
|
data/test/test_fauxsql.rb
CHANGED
@@ -119,7 +119,7 @@ class TestFauxsql < Test::Unit::TestCase
|
|
119
119
|
simple1 = SimpleKey.create
|
120
120
|
simple2 = SimpleKey.create
|
121
121
|
@faux.dictionary[simple1] = simple2
|
122
|
-
assert_equal
|
122
|
+
assert_equal simple2, @faux.dictionary[simple1]
|
123
123
|
reload
|
124
124
|
assert_equal simple2, @faux.dictionary[simple1]
|
125
125
|
end
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
+
- 1
|
7
8
|
- 0
|
8
|
-
|
9
|
-
version: 0.0.0
|
9
|
+
version: 0.1.0
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Collin Miller
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04-
|
17
|
+
date: 2010-04-12 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -83,7 +83,6 @@ files:
|
|
83
83
|
- README.rdoc
|
84
84
|
- Rakefile
|
85
85
|
- VERSION
|
86
|
-
- fauxsql.gemspec
|
87
86
|
- lib/fauxsql.rb
|
88
87
|
- lib/fauxsql/attribute.rb
|
89
88
|
- lib/fauxsql/attribute_list.rb
|
data/fauxsql.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 the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{fauxsql}
|
8
|
-
s.version = "0.0.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Collin Miller"]
|
12
|
-
s.date = %q{2010-04-20}
|
13
|
-
s.description = %q{And description}
|
14
|
-
s.email = %q{collintmiller@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE",
|
17
|
-
"README.rdoc"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
".gitignore",
|
22
|
-
"LICENSE",
|
23
|
-
"README.rdoc",
|
24
|
-
"Rakefile",
|
25
|
-
"VERSION",
|
26
|
-
"fauxsql.gemspec",
|
27
|
-
"lib/fauxsql.rb",
|
28
|
-
"lib/fauxsql/attribute.rb",
|
29
|
-
"lib/fauxsql/attribute_list.rb",
|
30
|
-
"lib/fauxsql/attribute_map.rb",
|
31
|
-
"lib/fauxsql/dereferenced_attribute.rb",
|
32
|
-
"lib/fauxsql/dsl.rb",
|
33
|
-
"test/helper.rb",
|
34
|
-
"test/test_fauxsql.rb"
|
35
|
-
]
|
36
|
-
s.homepage = %q{http://github.com/collin/fauxsql}
|
37
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
38
|
-
s.require_paths = ["lib"]
|
39
|
-
s.rubygems_version = %q{1.3.6}
|
40
|
-
s.summary = %q{This is summary}
|
41
|
-
s.test_files = [
|
42
|
-
"test/helper.rb",
|
43
|
-
"test/test_fauxsql.rb"
|
44
|
-
]
|
45
|
-
|
46
|
-
if s.respond_to? :specification_version then
|
47
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
48
|
-
s.specification_version = 3
|
49
|
-
|
50
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
51
|
-
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
52
|
-
s.add_runtime_dependency(%q<datamapper>, [">= 0"])
|
53
|
-
s.add_runtime_dependency(%q<do_sqlite3>, [">= 0"])
|
54
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 3.0.pre"])
|
55
|
-
else
|
56
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
57
|
-
s.add_dependency(%q<datamapper>, [">= 0"])
|
58
|
-
s.add_dependency(%q<do_sqlite3>, [">= 0"])
|
59
|
-
s.add_dependency(%q<activesupport>, [">= 3.0.pre"])
|
60
|
-
end
|
61
|
-
else
|
62
|
-
s.add_dependency(%q<shoulda>, [">= 0"])
|
63
|
-
s.add_dependency(%q<datamapper>, [">= 0"])
|
64
|
-
s.add_dependency(%q<do_sqlite3>, [">= 0"])
|
65
|
-
s.add_dependency(%q<activesupport>, [">= 3.0.pre"])
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|