This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_relative 'todoList' | |
| my_new_todo = Todo.new("some interesting stuff") | |
| top_to_do = Todo.new("This at the top") | |
| todo_list = TodoList.new | |
| # todo_list.list | |
| puts "ID | Date | Item | Priority | Completed | Tags |" | |
| puts "--------------------------------------------------------------------------------------------------------------------" | |
| # todo_list.append(my_new_todo.todo) | |
| # todo_list.prepend(top_to_do.todo) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Todo | |
| @@todo_id = 0 | |
| attr_accessor :todo | |
| def initialize(todo) | |
| @todo = {} | |
| text(todo) | |
| date_time(Time.now) | |
| todo_id | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class TodoFile | |
| attr_accessor :todo_file | |
| def initialize(filename) | |
| @filename = filename | |
| end | |
| def read(access='r') | |
| @todo_file = File.open(@filename, access) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require_relative 'todo_class' | |
| input = ARGV | |
| action = input.slice!(0) | |
| my_task = Todo.new | |
| puts "My TODO list" | |
| puts "---------------------" | |
| my_task.list if action == "list" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Todo_file | |
| attr_accessor :todo_file | |
| def initialize(filename) | |
| @filename = filename | |
| end | |
| def read(access='r') | |
| @todo_file = File.open(@filename, access) | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #People | |
| # class Database | |
| # | |
| # attr_accessor :records | |
| # | |
| # @@max_record_id = 0 | |
| # @@records = [] | |
| # | |
| # def next_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Oven | |
| def initialize | |
| end | |
| def heat(temperature=350) | |
| temperature | |
| end | |
| def has_batch? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Oven | |
| def initialize | |
| end | |
| def heat(temperature=350) | |
| temperature | |
| end | |
| def has_batch? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'pry' | |
| class NumbersToWords | |
| def initialize | |
| @single = %w[zero one two three four five six seven eight nine ten elevin | |
| twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen] | |
| @tens = %w[twenty thirty fourty fifty sixty seventy eighty ninety] | |
| @words = "" | |
| end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| =begin | |
| Given an array and a number that we are looking for | |
| Find midpoint of array | |
| is number equal to the midpoint? | |
| return index of number | |
| Is it greater? | |
| set midpoint + 1 as new_min | |
| recurse | |
| Is it less? |