contextify 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +5 -0
- data/lib/contextify/contextify.rb +4 -0
- data/lib/contextify/version.rb +1 -1
- data/spec/contextify_spec.rb +24 -12
- metadata +3 -3
data/History.txt
CHANGED
@@ -12,6 +12,10 @@ module Contextify
|
|
12
12
|
|
13
13
|
meta_def(:context_name) { name }
|
14
14
|
|
15
|
+
meta_def(:load_context_block) do |path|
|
16
|
+
Contextify.load_block(name,path)
|
17
|
+
end
|
18
|
+
|
15
19
|
meta_def(:load_context) do |path,*args|
|
16
20
|
Contextify.load_context(self.context_name,path,*args)
|
17
21
|
end
|
data/lib/contextify/version.rb
CHANGED
data/spec/contextify_spec.rb
CHANGED
@@ -31,26 +31,38 @@ describe Contextify do
|
|
31
31
|
}.should raise_error(Contextify::ContextNotFound)
|
32
32
|
end
|
33
33
|
|
34
|
+
it "should load a block by context-name from a file" do
|
35
|
+
block = Contextify.load_block(:book, @snow_crash_path)
|
36
|
+
|
37
|
+
block.should_not be_nil
|
38
|
+
end
|
39
|
+
|
34
40
|
it "should load contexts by context-name from a file" do
|
35
|
-
|
36
|
-
|
37
|
-
|
41
|
+
book = Contextify.load_context(:book, @snow_crash_path)
|
42
|
+
book.should_not be_nil
|
43
|
+
book.class.should == Book
|
38
44
|
end
|
39
45
|
|
40
46
|
it "should load a specific context from a file with multiple contexts" do
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
book = Contextify.load_context(:book, @neuromancer_path)
|
48
|
+
book.should_not be_nil
|
49
|
+
book.class.should == Book
|
50
|
+
|
51
|
+
review = Contextify.load_context(:book_review, @neuromancer_path)
|
52
|
+
review.should_not be_nil
|
53
|
+
review.class.should == BookReview
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should provide class-level methods for loading a context block" do
|
57
|
+
block = Book.load_context_block(@snow_crash_path)
|
44
58
|
|
45
|
-
|
46
|
-
@review.should_not be_nil
|
47
|
-
@review.class.should == BookReview
|
59
|
+
block.should_not be_nil
|
48
60
|
end
|
49
61
|
|
50
62
|
it "should provide class-level methods for loading a context" do
|
51
|
-
|
52
|
-
|
53
|
-
|
63
|
+
book = Book.load_context(@snow_crash_path)
|
64
|
+
book.should_not be_nil
|
65
|
+
book.class.should == Book
|
54
66
|
end
|
55
67
|
|
56
68
|
describe "loaded contexts" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: contextify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Postmodern
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-02-06 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.8.
|
23
|
+
version: 1.8.3
|
24
24
|
version:
|
25
25
|
description: Load Objects from Ruby files without having to use YAML or define classes named like the file.
|
26
26
|
email:
|