diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..bd89935
Binary files /dev/null and b/.DS_Store differ
diff --git a/.idea/.name b/.idea/.name
new file mode 100644
index 0000000..dedc45b
--- /dev/null
+++ b/.idea/.name
@@ -0,0 +1 @@
+odev-01ruby
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..97626ba
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..267d569
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..4709cc6
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/odev-01ruby.iml b/.idea/odev-01ruby.iml
new file mode 100644
index 0000000..56cd710
--- /dev/null
+++ b/.idea/odev-01ruby.iml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..4634b51
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,337 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Ruby
+
+
+
+
+ RubyResolve
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1457359416994
+
+ 1457359416994
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Gemfile b/Gemfile
index 90531fb..2b8ce04 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1 +1,3 @@
+source 'https://rubygems.org'
+
gem 'minitest'
diff --git a/Gemfile.lock b/Gemfile.lock
index 3cbeae8..3d189f7 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,4 +1,5 @@
GEM
+ remote: https://rubygems.org/
specs:
minitest (5.8.1)
diff --git a/address_book.rb b/address_book.rb
index e5406d1..8099edc 100644
--- a/address_book.rb
+++ b/address_book.rb
@@ -1,13 +1,30 @@
+require 'csv'
+require './person.rb'
+
class AddressBook
- def initialize(csv_path)
+ attr_accessor :people
+
+ def initialize(csv_path)
+ @people = []
+ CSV.foreach(csv_path) do |row|
+ people.push(Person.new(row[0], row[1], row[2],row[3]))
+ end
end
def print_people
-
+ people.each do |person|
+ puts "#{person.id}, #{person.full_name}, #{person.phone_number}, #{person.city}"
+ end
end
def search_person(person_name)
-
+ people.each do |person|
+ if person.full_name.to_s.include? person_name
+ puts "#{person.id}, #{person.full_name}, #{person.phone_number}, #{person.city}"
+ return
+ end
+ end
+ puts "#{person_name} bulunamadı."
end
end
diff --git a/main.rb b/main.rb
index 3996187..023ad3a 100644
--- a/main.rb
+++ b/main.rb
@@ -3,4 +3,4 @@
address_book = AddressBook.new("people.csv")
address_book.print_people
-address_book.search_person("Michael")
+address_book.search_person("Roy")
diff --git a/person.rb b/person.rb
index ab139ec..889fb13 100644
--- a/person.rb
+++ b/person.rb
@@ -1,3 +1,12 @@
class Person
+ attr_accessor :id, :full_name, :phone_number, :city
+
+ def initialize(id, full_name, phone_number, city)
+ @id = id
+ @full_name = full_name
+ @phone_number = phone_number
+ @city = city
+ end
+
end