Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
7626621
Remove .DS_Store
selfeik Feb 21, 2018
f2c3fab
Merge branch 'master' of https://github.com/DavidNV/make_it_real_lessons
selfeik Feb 22, 2018
e21d73d
Archivo base de challenges
selfeik Feb 23, 2018
56ce9c3
Merge branch 'master' of https://github.com/DavidNV/make_it_real_lessons
selfeik Feb 26, 2018
f72dbc4
Merge branch 'master' of https://github.com/DavidNV/make_it_real_lessons
selfeik Feb 27, 2018
13a47b1
Cree la clase actor
selfeik Feb 27, 2018
5e9601e
Definí método constructor
selfeik Feb 27, 2018
af173cb
Cree clase TV
selfeik Feb 27, 2018
78da0a4
Definí la clase Tv además agregué metodos
selfeik Feb 27, 2018
a0e81a2
Create a superclass Entertainment. And Actress class going to inherit…
selfeik Feb 27, 2018
8404e55
Los métodos turn_on y turn_off quedaron públicos
selfeik Feb 28, 2018
c4e6250
Cree archivos independientes para todas las clases
selfeik Feb 28, 2018
e73231f
Cree la clase car
selfeik Feb 28, 2018
2494cbf
Creé clase Chair
selfeik Feb 28, 2018
7a3ea0a
Creé la clase actor
selfeik Feb 28, 2018
e2e0f15
Merge branch 'master' of https://github.com/DavidNV/make_it_real_less…
selfeik Feb 28, 2018
5aa81c8
Añadí metodos a la clase Car
selfeik Feb 28, 2018
eeba26a
Modifiqué las clases actor y chair además cree una nueva clase para tv
selfeik Feb 28, 2018
17aa20f
Relación entre dos clases TV y Actor
selfeik Mar 1, 2018
a7f920c
Agregué un nuevo parámetro al la clase actor
selfeik Mar 1, 2018
a76eb3f
Intento de relacionar Tv con Car
selfeik Mar 1, 2018
32116ae
Creé nuevo módulo
selfeik Mar 2, 2018
8f54e80
Merge branch 'master' of https://github.com/DavidNV/make_it_real_less…
selfeik Mar 2, 2018
7c35712
Añadir módulo
selfeik Mar 2, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.DS_Store
*.sw*
26 changes: 26 additions & 0 deletions objects_class/actor.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
class Actor

attr_accessor :genre

def initialize(show_name, actor_name, genre)
@show_name = show_name
@actor_name = actor_name
@genre = genre
end

def altered_carbon_show
if @show_name == "Altered Carbon"
"I'm an actor of this show"
else
"I don't work here"
end
end

def actor
@actor_name
end

def show_name
@show_name
end
end
13 changes: 13 additions & 0 deletions objects_class/actress.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Actress < Entertainment
def initialize(netflix_show, genre, schedule, price)
@netflix_show = netflix_show
@genre = genre
@schedule = schedule
@price = price
end

#show en el que sale
def actress_shows
"Show 1"
end
end
36 changes: 36 additions & 0 deletions objects_class/car.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
class Car

attr_accessor :location

def initialize(gps, location, speed)
@gps = gps
@location = location
@speed = speed
end

def self_driving
"Driving"
end

def to_s
"My speed is #{@speed}"
end

def speed_limit
if @speed.eql?40
"You are driving OK"
else
"Slow down duuuude"
end
end

def detect_accident
if @location.eql?("Bogotá") && @gps <= 30
"There's an accident, you should change your route"
else
"I can't find anything"
end
end

end

25 changes: 25 additions & 0 deletions objects_class/chair.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
class Chair
def initialize(year, type)
@year = year
@type = type
end

def group_car_chair
if @type == "car"
"This is a chair for a car"
else
"This is another type of chair"
end
end

def maintenance_chair
if @year < 2000
"You should check the state of your chair"
else
"It's functional"
end
end
end

new_chair = Chair.new(2018, "car")
p new_chair.maintenance_chair
3 changes: 3 additions & 0 deletions objects_class/entertaiment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Entertainment
#relacionar tv con actriz
end
12 changes: 12 additions & 0 deletions objects_class/entertainment.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require './tv_new'


new_tv = TvNew.new("netflix", "scifi", "Comercial carros")
puts new_tv.inspect
puts new_tv.comercial
puts new_tv.new_actor("Mute", "Lina", "Drama")
puts new_tv.show_actor_shows
puts new_tv.show_actor_genre

puts new_tv.new_car(100, "Cali", 60)
puts new_tv.go_to_comercial
6 changes: 6 additions & 0 deletions objects_class/module.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
require '.tv_new'
require '.actor'

module ActorShow

end
58 changes: 58 additions & 0 deletions objects_class/tv.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
require './actress'

class Tv

def initialize(smart, screen, size, energy)
@smart = smart
@screen = screen
@size = size
@energy = energy
end

#muestre el menu con las opciones
def show_menu
menu
@home = home
@channels = {"Sony channel" => 10, "Warner channel" => 20, "Fox channel" => 30}
@store = store
@netflix = netflix
end

#cambie los canales
def change_channels
end

#vaya a la app de netflix
def go_to_netflix_show(netflix_show)
#para relacionar al tv con la actriz
actress_show
end

#vaya al store
def go_to_store
end

#encender
def turn_on
"Welcome to this new experience"
end

#apagar
def turn_off
"Bye"
end

#menú
def menu
if @size >= 52
puts "Home"
puts "Channels"
puts "Store"
else
turn_off
end
end
end

new_tv = Tv.new("smart", "flat", 52, 260)
puts new_tv.show_menu
51 changes: 51 additions & 0 deletions objects_class/tv_new.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
require './actor'
require './car'

class TvNew

attr_accessor :lina
attr_accessor :comercial

def initialize(app, genre, comercial)
@app = app
@genre = genre
@comercial = comercial
end

def go_to_netflix
if @app == "netflix"
"This is Netflix what you want to watch?"
else
"You're watching "
end
end

def altered_carbon_show
if @app == "netflix" && @genre == "scifi"
"Altered Carbon -> Play"
else
"Choose another show"
end
end

def new_actor(show_name, actor_name, genre)
@lina ||= Actor.new(show_name, actor_name, genre)
end

def show_actor_shows
lina.show_name
end

def show_actor_genre
lina.genre
end

def new_car(gps, location, speed)
@car_new ||= Car.new(gps, location, speed)
end


def go_to_comercial
car_new.speed
end
end
12 changes: 6 additions & 6 deletions objects_examples/tv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ def change_channel(new_channel)
end
end

def actor(actor_name)
Actor.new(actor_name)
end

# def actor(actor_name)
# @actor ||= Actor.new(actor_name)
# Actor.new(actor_name)
# end

end
def actor(actor_name)
@actor ||= Actor.new(actor_name)
end

end
2 changes: 1 addition & 1 deletion ruby_1/challenges.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

3. Add the body to the funciont max_number that outputs the higher number between two inputs

3. Add the body to the funciont is_in_my_range? that outputs if a number is between 0 and 100
3. Add the body to the funciont is_in_my_range? that outputs if a number is between 0 and 100

=end

Expand Down