upcoming_movies_in_the_park 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 067949bb69ec00c66196f1e4d0437474d1bc9c29
4
- data.tar.gz: 2567a11a8088795401de5b9d6deedab82bc2b950
3
+ metadata.gz: 4b0745e1f5bb40f1fb99715a96b8c8af5996bbaa
4
+ data.tar.gz: 1d9d9b2ab25e2d2279b040cf5b5f1af3ca524003
5
5
  SHA512:
6
- metadata.gz: ad16ce5aa7015b0a65eace691e1f6bfa5580f3e8a7b69646a4cac752849dde86d45f40a83f8447fe234fdb00825ff469e8405d26080b5d4008ee78ea687b5cb9
7
- data.tar.gz: 7fe5fc7daba6319ff41373d2a6d3d7f0d03a19637a2efea8a8048f4814edbe40f293e3fea8b2d55ec385112cd457e88a0f35ef9b8f61badfcd25a95b85a51d63
6
+ metadata.gz: 2b82c6604723c229bc51220901d4d6a37c93cc94e457eb1f7b11f656a11ada7b51ef10c798b3d06ab1eaf2cb394feee17b498e6523abd7b874fca3cb8bf844d3
7
+ data.tar.gz: 0cd935d4f4e93d4a54a7a0c7b861f65d9344a113a043be6580afe829108b7c3cf8665108a9c1b29eb7b9a1ffdf3a31d2957905a00f044362559c55961fc3bead
@@ -7,4 +7,5 @@ require_relative '../lib/upcoming_movies_in_the_park/cli'
7
7
  require_relative '../lib/upcoming_movies_in_the_park/showing'
8
8
  require_relative '../lib/upcoming_movies_in_the_park/park'
9
9
  require_relative '../lib/upcoming_movies_in_the_park/gate'
10
- require_relative '../lib/upcoming_movies_in_the_park/scraper'
10
+ require_relative '../lib/upcoming_movies_in_the_park/scraper'
11
+ require_relative '../lib/upcoming_movies_in_the_park/super'
@@ -1,5 +1,5 @@
1
1
  require_relative '../config/environment'
2
2
 
3
3
  module UpcomingMoviesInThePark
4
- # Your code goes here...
4
+
5
5
  end
@@ -41,7 +41,7 @@ class UpcomingMoviesInThePark::CLI
41
41
  break
42
42
  else
43
43
  puts "\n"
44
- puts "Hrm, I don't understand what you want.".colorize(:blue)
44
+ puts hrm.colorize(:blue)
45
45
  print "Please enter".colorize(:blue)
46
46
  print " by name"
47
47
  print ", ".colorize(:blue)
@@ -55,6 +55,10 @@ class UpcomingMoviesInThePark::CLI
55
55
  end
56
56
  end
57
57
 
58
+ def hrm
59
+ "Hrm, I don't understand what you want."
60
+ end
61
+
58
62
  def by_name_path
59
63
  puts "\n"
60
64
  UpcomingMoviesInThePark::Showing.list_by_name
@@ -74,7 +78,7 @@ class UpcomingMoviesInThePark::CLI
74
78
  menu
75
79
  break
76
80
  else
77
- puts "Hrm, I don't understand what you want.".colorize(:green)
81
+ puts hrm.colorize(:green)
78
82
  by_name_instructions
79
83
  end
80
84
  end
@@ -104,35 +108,39 @@ class UpcomingMoviesInThePark::CLI
104
108
  puts "\n"
105
109
  by_date_instructions_2
106
110
  input = nil
107
- while input != "return"
108
- input = gets.strip
109
- if input.to_i > 0 && input.to_i <= date.showings.length
110
- showing = date.showings[input.to_i - 1]
111
- puts "\n"
112
- showing.display_details
113
- puts "\n"
114
- by_date_instructions_2
115
- elsif input == "return"
116
- puts "\n"
117
- UpcomingMoviesInThePark::Gate.list_by_date
118
- puts "\n"
119
- by_date_instructions_1
120
- break
121
- else
122
- puts "Hrm, I don't understand what you want.".colorize(:cyan)
123
- by_date_instructions_2
124
- end
125
- end
111
+ by_date_path_2
126
112
  elsif input == "back"
127
113
  menu
128
114
  break
129
115
  else
130
- puts "Hrm, I don't understand what you want.".colorize(:green)
116
+ puts hrm.colorize(:green)
131
117
  by_date_instructions_1
132
118
  end
133
119
  end
134
120
  end
135
121
 
122
+ def by_date_path_2
123
+ while input != "return"
124
+ input = gets.strip
125
+ if input.to_i > 0 && input.to_i <= date.showings.length
126
+ showing = date.showings[input.to_i - 1]
127
+ puts "\n"
128
+ showing.display_details
129
+ puts "\n"
130
+ by_date_instructions_2
131
+ elsif input == "return"
132
+ puts "\n"
133
+ UpcomingMoviesInThePark::Gate.list_by_date
134
+ puts "\n"
135
+ by_date_instructions_1
136
+ break
137
+ else
138
+ puts hrm.colorize(:cyan)
139
+ by_date_instructions_2
140
+ end
141
+ end
142
+ end
143
+
136
144
  def by_date_instructions_1
137
145
  print "Enter ".colorize(:green)
138
146
  print "a number "
@@ -167,35 +175,39 @@ class UpcomingMoviesInThePark::CLI
167
175
  puts "\n"
168
176
  by_park_instructions_2
169
177
  input = nil
170
- while input != "return"
171
- input = gets.strip
172
- if input.to_i > 0 && input.to_i <= park.showings.length
173
- showing = park.showings[input.to_i - 1]
174
- puts "\n"
175
- showing.display_details
176
- puts "\n"
177
- by_park_instructions_2
178
- elsif input == "return"
179
- puts "\n"
180
- UpcomingMoviesInThePark::Park.list_by_name
181
- puts "\n"
182
- by_park_instructions_1
183
- break
184
- else
185
- puts "Hrm, I don't understand what you want.".colorize(:cyan)
186
- by_park_instructions_2
187
- end
188
- end
178
+ by_park_path_2
189
179
  elsif input == "back"
190
180
  menu
191
181
  break
192
182
  else
193
- puts "Hrm, I don't understand what you want.".colorize(:green)
183
+ puts hrm.colorize(:green)
194
184
  by_park_instructions_1
195
185
  end
196
186
  end
197
187
  end
198
188
 
189
+ def by_park_path_2
190
+ while input != "return"
191
+ input = gets.strip
192
+ if input.to_i > 0 && input.to_i <= park.showings.length
193
+ showing = park.showings[input.to_i - 1]
194
+ puts "\n"
195
+ showing.display_details
196
+ puts "\n"
197
+ by_park_instructions_2
198
+ elsif input == "return"
199
+ puts "\n"
200
+ UpcomingMoviesInThePark::Park.list_by_name
201
+ puts "\n"
202
+ by_park_instructions_1
203
+ break
204
+ else
205
+ puts hrm.colorize(:cyan)
206
+ by_park_instructions_2
207
+ end
208
+ end
209
+ end
210
+
199
211
  def by_park_instructions_1
200
212
  print "Enter ".colorize(:green)
201
213
  print "a number"
@@ -1,17 +1,16 @@
1
+ require_relative './super'
2
+
1
3
  class UpcomingMoviesInThePark::Gate
2
4
  attr_accessor :name, :day, :month, :year, :showings
3
5
 
4
- @@all = []
5
- # date info pulled from web, this'll be the name, then parse it to get desired info
6
- #"\n Date & Time:\n Mon, Jun 11, 2018 from 8:30 PM - 10:22 PM\n "
6
+ include UpcomingMoviesInThePark::Super::InstanceMethods
7
+ include UpcomingMoviesInThePark::Super::GateParkInstanceMethods
7
8
 
8
- def save
9
- @@all << self
10
- end
9
+ @@all =[]
11
10
 
12
11
  def self.all
13
12
  @@all
14
- end
13
+ end
15
14
 
16
15
  def initialize(name)
17
16
  @showings =[]
@@ -32,18 +31,9 @@ class UpcomingMoviesInThePark::Gate
32
31
  end
33
32
  end
34
33
 
35
- def add_showing(showing)
36
- @showings << showing
37
- end
38
-
39
34
  def self.list_by_date
40
35
  self.all.each_with_index {|gate, i|
41
36
  puts "#{i +1}. #{gate.month} #{gate.day}, #{gate.year}".colorize(:green)}
42
37
  end
43
38
 
44
- def list_showings
45
- @showings.each_with_index {|showing, i|
46
- puts "#{i +1}. #{showing.name}".colorize(:cyan)}
47
- end
48
-
49
39
  end
@@ -1,11 +1,15 @@
1
+ require_relative './super'
2
+
1
3
  class UpcomingMoviesInThePark::Park
2
4
  attr_accessor :name, :showings
5
+ include UpcomingMoviesInThePark::Super::InstanceMethods
6
+ include UpcomingMoviesInThePark::Super::GateParkInstanceMethods
3
7
 
4
- @@all = []
8
+ @@all =[]
5
9
 
6
- def save
7
- @@all << self
8
- end
10
+ def self.all
11
+ @@all
12
+ end
9
13
 
10
14
  def initialize(name)
11
15
  @name = name
@@ -13,10 +17,6 @@ class UpcomingMoviesInThePark::Park
13
17
  self.save
14
18
  end
15
19
 
16
- def self.all
17
- @@all
18
- end
19
-
20
20
  def self.find_or_create_by_name(name)
21
21
  if @@all.any? {|park| park.name == name}
22
22
  @@all.find {|park|
@@ -26,18 +26,9 @@ class UpcomingMoviesInThePark::Park
26
26
  end
27
27
  end
28
28
 
29
- def add_showing(showing)
30
- @showings << showing
31
- end
32
-
33
29
  def self.list_by_name
34
30
  self.all.each_with_index {|park, i|
35
31
  puts "#{i +1}. #{park.name}".colorize(:green)}
36
32
  end
37
33
 
38
- def list_showings
39
- @showings.each_with_index {|showing, i|
40
- puts "#{i +1}. #{showing.name}".colorize(:cyan)}
41
- end
42
-
43
34
  end
@@ -1,7 +1,10 @@
1
1
  require_relative './park'
2
2
  require_relative './gate'
3
+ require_relative './super'
3
4
 
4
5
  class UpcomingMoviesInThePark::Showing
6
+ include UpcomingMoviesInThePark::Super::InstanceMethods
7
+
5
8
  attr_accessor :name, :url
6
9
  attr_reader :date, :park
7
10
 
@@ -21,10 +24,6 @@ class UpcomingMoviesInThePark::Showing
21
24
  puts "on #{@date.month} #{@date.day}, #{@date.year} in #{@park.name}.".colorize(:red)
22
25
  end
23
26
 
24
- def save
25
- @@all << self
26
- end
27
-
28
27
  def time
29
28
  data = self.date.name.split(/, | |\n/)
30
29
  time = "#{data[37]} #{data[38]} to #{data[40]} #{data[41]}"
@@ -0,0 +1,24 @@
1
+ module UpcomingMoviesInThePark::Super
2
+
3
+ module InstanceMethods
4
+
5
+ def save
6
+ self.class.all << self
7
+ end
8
+
9
+ def list_showings
10
+ self.showings.each_with_index {|showing, i|
11
+ puts "#{i +1}. #{showing.name}".colorize(:cyan)}
12
+ end
13
+
14
+ end
15
+
16
+ module GateParkInstanceMethods
17
+
18
+ def add_showing(showing)
19
+ self.showings << showing
20
+ end
21
+
22
+ end
23
+
24
+ end
@@ -1,3 +1,3 @@
1
1
  module UpcomingMoviesInThePark
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: upcoming_movies_in_the_park
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - sgibson47
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-08 00:00:00.000000000 Z
11
+ date: 2018-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -106,6 +106,7 @@ files:
106
106
  - lib/upcoming_movies_in_the_park/park.rb
107
107
  - lib/upcoming_movies_in_the_park/scraper.rb
108
108
  - lib/upcoming_movies_in_the_park/showing.rb
109
+ - lib/upcoming_movies_in_the_park/super.rb
109
110
  - lib/upcoming_movies_in_the_park/version.rb
110
111
  - spec.md
111
112
  - upcoming_movies_in_the_park-0.1.0.gem