ascheink-active_yaml 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/active_yaml.gemspec +2 -2
- data/lib/active_yaml.rb +5 -4
- data/test/active_yaml_test.rb +4 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/active_yaml.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{active_yaml}
|
5
|
-
s.version = "0.0.
|
5
|
+
s.version = "0.0.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Andrei Scheinkman"]
|
9
|
-
s.date = %q{2009-07-
|
9
|
+
s.date = %q{2009-07-07}
|
10
10
|
s.email = %q{andreischeinkman@gmail.com}
|
11
11
|
s.extra_rdoc_files = [
|
12
12
|
"LICENSE",
|
data/lib/active_yaml.rb
CHANGED
@@ -22,11 +22,12 @@ class ActiveYAML
|
|
22
22
|
class_eval "def self.find_all_by_#{key}(x); @instances.find_all { |i| i.#{key} == x }; end"
|
23
23
|
end
|
24
24
|
end
|
25
|
-
class_eval "def self.find(id); find_by_id(id) or raise ActiveRecord::RecordNotFound; end"
|
26
|
-
class_eval "def self.first; @instances.first or raise ActiveRecord::RecordNotFound; end"
|
27
|
-
class_eval "def self.last; @instances.last or raise ActiveRecord::RecordNotFound; end"
|
28
25
|
end
|
29
|
-
|
26
|
+
class_eval "def self.find(id); find_by_id(id) or raise ActiveRecord::RecordNotFound; end"
|
27
|
+
class_eval "def self.first; @instances.first; end"
|
28
|
+
class_eval "def self.last; @instances.last; end"
|
29
|
+
s = "#{p.to_s}(#{fields.join(', ')})"
|
30
|
+
class_eval "def self.to_s; \"#{s}\"; end"
|
30
31
|
def self.find_all
|
31
32
|
@instances
|
32
33
|
end
|
data/test/active_yaml_test.rb
CHANGED
@@ -26,6 +26,10 @@ class ActiveYamlTest < Test::Unit::TestCase
|
|
26
26
|
assert_respond_to City, :find_all_by_display_name
|
27
27
|
assert_respond_to City, :find_all_by_population
|
28
28
|
end
|
29
|
+
|
30
|
+
should "print out fields in to_s" do
|
31
|
+
assert_equal "City(id, population, display_name)", City.to_s
|
32
|
+
end
|
29
33
|
end
|
30
34
|
|
31
35
|
context "instance" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ascheink-active_yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Scheinkman
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-07-
|
12
|
+
date: 2009-07-07 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|