movieDB 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/movieDB.rb +2 -1
- data/lib/movieDB/person.rb +13 -2
- data/lib/movieDB/version.rb +1 -1
- data/spec/movieDB_spec.rb +2 -2
- data/spec/person_spec.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7522418d9aeaec5ff6eb52d3cfe694f617162546
|
4
|
+
data.tar.gz: f3ae4a57ba1804cb38521ccb96edb6cd7739e36d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dcca13a7c59c4b4c90b3fc9f13a217137d8186d994a1fb849e506ae14bd79a5f0acd880dd3120d9e59cb6dbe47335c0439e08256eea660e571e917d0b3f5daf
|
7
|
+
data.tar.gz: 6867b912311c3d337a500df2b97caf3fe296bf458a3b3fd13043d90e26ee43b8fcfc6f4a0c5033e3e79be3e9ed7cee424c20cf6e2658db9442d27b8e94f606e3
|
data/lib/movieDB.rb
CHANGED
@@ -14,7 +14,7 @@ require "movieDB/version"
|
|
14
14
|
# Example
|
15
15
|
# movie = Movie.new()
|
16
16
|
# movie.title = "When Sally Met Harry"
|
17
|
-
unless defined? MovieDB
|
17
|
+
unless defined? MovieDB::Movie
|
18
18
|
module MovieDB
|
19
19
|
class Movie < MovieDB::Base
|
20
20
|
|
@@ -135,3 +135,4 @@ unless defined? MovieDB
|
|
135
135
|
end
|
136
136
|
end
|
137
137
|
end
|
138
|
+
|
data/lib/movieDB/person.rb
CHANGED
@@ -9,10 +9,10 @@ require 'time'
|
|
9
9
|
# # actor_name = actor.map(&:name) #=> ["Brittany Murphy"]
|
10
10
|
#
|
11
11
|
# # Alive?
|
12
|
-
# # actor_name = actor.map(&:alive?) #=> [false, true]
|
12
|
+
# # actor_name = actor.map(&:alive?) #=> [false, true]
|
13
13
|
#
|
14
14
|
# # Age
|
15
|
-
# # actor_name = actor.map(&:age) #=> [32, 52]
|
15
|
+
# # actor_name = actor.map(&:age) #=> [32, 52]
|
16
16
|
#
|
17
17
|
|
18
18
|
module MovieDB
|
@@ -57,6 +57,17 @@ module MovieDB
|
|
57
57
|
raise ArgumentError, "#{attr} can only be name or age" if !attr == :age && :name
|
58
58
|
return @person_DS.select{|s| s.alive?}.map(&attr)
|
59
59
|
end
|
60
|
+
|
61
|
+
##
|
62
|
+
# Returns a random parameter integer between min to max,
|
63
|
+
# rather than a float between min to max.(Ruby 2.0.0)
|
64
|
+
#
|
65
|
+
|
66
|
+
def sample_attr(attr)
|
67
|
+
randgen = Object.new
|
68
|
+
attr_array = self.instance_eval{filter_person(attr)}
|
69
|
+
attr_array.sample(random: randgen)
|
70
|
+
end
|
60
71
|
end
|
61
72
|
private_class_method :create_with_info, :filter_person
|
62
73
|
end
|
data/lib/movieDB/version.rb
CHANGED
data/spec/movieDB_spec.rb
CHANGED
@@ -55,10 +55,10 @@ describe MovieDB do
|
|
55
55
|
|
56
56
|
context "#capture" do
|
57
57
|
let!(:newCap){ MovieDB::Movie.new()}
|
58
|
-
|
58
|
+
|
59
59
|
it "should accept new synopsis argument" do
|
60
60
|
newCap.capture( synopsis: "Last Vegas - Four geriatric friends vow to set Las Vegas Ablaze.").should === {:synopsis=>"Last Vegas - Four geriatric friends vow to set Las Vegas Ablaze."}
|
61
|
-
|
61
|
+
|
62
62
|
end
|
63
63
|
end
|
64
64
|
end
|
data/spec/person_spec.rb
CHANGED
@@ -5,10 +5,18 @@ describe MovieDB::Person do
|
|
5
5
|
context "#filter_person" do
|
6
6
|
it "should return attributes" do
|
7
7
|
MovieDB::Person.instance_eval{create_with_info("Brittany Murphy", "F", "1977-11-10", "2009-12-20")}
|
8
|
-
MovieDB::Person.instance_eval{create_with_info("George Clooney", "M", "1961-05-06",
|
8
|
+
MovieDB::Person.instance_eval{create_with_info("George Clooney", "M", "1961-05-06", "")}
|
9
|
+
|
10
|
+
MovieDB::Person.instance_eval{filter_person('name')}.should == ['Brittany Murphy', 'George Clooney']
|
11
|
+
end
|
12
|
+
end
|
9
13
|
|
14
|
+
context "" do
|
15
|
+
it "should return a random integer bewreen min to max" do
|
16
|
+
age = MovieDB::Person.instance_eval{filter_person('age')}
|
17
|
+
moviePerson = MovieDB::Person.instance_eval{sample_attr('age')}
|
10
18
|
|
11
|
-
|
19
|
+
moviePerson.should be_in(age)
|
12
20
|
end
|
13
21
|
end
|
14
22
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: movieDB
|
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
|
- Albert_McKeever
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-11-
|
11
|
+
date: 2013-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|