active_hash 0.6.1
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/.document +5 -0
- data/.gitignore +6 -0
- data/CHANGELOG +13 -0
- data/LICENSE +20 -0
- data/README.md +202 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/active_hash.gemspec +59 -0
- data/lib/active_file/base.rb +60 -0
- data/lib/active_hash.rb +5 -0
- data/lib/active_hash/base.rb +188 -0
- data/lib/active_yaml/base.rb +16 -0
- data/spec/active_file/base_spec.rb +265 -0
- data/spec/active_hash/base_spec.rb +541 -0
- data/spec/active_yaml/base_spec.rb +20 -0
- data/spec/active_yaml/sample.yml +15 -0
- data/spec/spec_helper.rb +9 -0
- metadata +87 -0
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec/spec_helper'
|
2
|
+
|
3
|
+
describe ActiveYaml::Base do
|
4
|
+
|
5
|
+
describe ".all" do
|
6
|
+
it "loads the data from the yml file" do
|
7
|
+
class SomeArbitraryClass < ActiveYaml::Base
|
8
|
+
set_root_path File.dirname(__FILE__)
|
9
|
+
set_filename "sample"
|
10
|
+
field :name
|
11
|
+
end
|
12
|
+
|
13
|
+
records = SomeArbitraryClass.all
|
14
|
+
records.length.should == 3
|
15
|
+
records.should =~ [SomeArbitraryClass.new(:id => 1), SomeArbitraryClass.new(:id => 2), SomeArbitraryClass.new(:id => 3)]
|
16
|
+
records.first.name.should == "US"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
- id: 1
|
2
|
+
name: US
|
3
|
+
independence_date: 1776-07-04
|
4
|
+
created_at: Wed Jul 22 22:41:44 -0400 2009
|
5
|
+
custom_field_1: value1
|
6
|
+
- id: 2
|
7
|
+
name: Canada
|
8
|
+
independence_date: 1867-07-01
|
9
|
+
created_at: Wed Jul 22 22:41:44 -0400 2009
|
10
|
+
custom_field_2: value2
|
11
|
+
- id: 3
|
12
|
+
name: Mexico
|
13
|
+
independence_date: 1810-09-16
|
14
|
+
created_at: Wed Jul 22 22:41:44 -0400 2009
|
15
|
+
custom_field_3: value3
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: active_hash
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.6.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jeff Dean
|
8
|
+
- Mike Dalessio
|
9
|
+
- Corey Innis
|
10
|
+
- Peter Jaros
|
11
|
+
autorequire:
|
12
|
+
bindir: bin
|
13
|
+
cert_chain: []
|
14
|
+
|
15
|
+
date: 2009-08-19 00:00:00 -04:00
|
16
|
+
default_executable:
|
17
|
+
dependencies:
|
18
|
+
- !ruby/object:Gem::Dependency
|
19
|
+
name: activesupport
|
20
|
+
type: :runtime
|
21
|
+
version_requirement:
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: "0"
|
27
|
+
version:
|
28
|
+
description:
|
29
|
+
email: jeff@zilkey.com
|
30
|
+
executables: []
|
31
|
+
|
32
|
+
extensions: []
|
33
|
+
|
34
|
+
extra_rdoc_files:
|
35
|
+
- LICENSE
|
36
|
+
- README.md
|
37
|
+
files:
|
38
|
+
- .document
|
39
|
+
- .gitignore
|
40
|
+
- CHANGELOG
|
41
|
+
- LICENSE
|
42
|
+
- README.md
|
43
|
+
- Rakefile
|
44
|
+
- VERSION
|
45
|
+
- active_hash.gemspec
|
46
|
+
- lib/active_file/base.rb
|
47
|
+
- lib/active_hash.rb
|
48
|
+
- lib/active_hash/base.rb
|
49
|
+
- lib/active_yaml/base.rb
|
50
|
+
- spec/active_file/base_spec.rb
|
51
|
+
- spec/active_hash/base_spec.rb
|
52
|
+
- spec/active_yaml/base_spec.rb
|
53
|
+
- spec/active_yaml/sample.yml
|
54
|
+
- spec/spec_helper.rb
|
55
|
+
has_rdoc: true
|
56
|
+
homepage: http://github.com/zilkey/active_hash
|
57
|
+
licenses: []
|
58
|
+
|
59
|
+
post_install_message:
|
60
|
+
rdoc_options:
|
61
|
+
- --charset=UTF-8
|
62
|
+
require_paths:
|
63
|
+
- lib
|
64
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: "0"
|
75
|
+
version:
|
76
|
+
requirements: []
|
77
|
+
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 1.3.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 2
|
82
|
+
summary: An ActiveRecord-like model that uses a hash as a datasource
|
83
|
+
test_files:
|
84
|
+
- spec/active_file/base_spec.rb
|
85
|
+
- spec/active_hash/base_spec.rb
|
86
|
+
- spec/active_yaml/base_spec.rb
|
87
|
+
- spec/spec_helper.rb
|