class Rubedility::Task
Attributes
content[RW]
difficulty[RW]
name[RW]
tagline[RW]
task_reading_url[RW]
task_url[RW]
Public Class Methods
all()
click to toggle source
# File lib/rubedility/task.rb, line 30 def self.all @@all end
create_from_collection(task_hash)
click to toggle source
# File lib/rubedility/task.rb, line 11 def self.create_from_collection(task_hash) task_hash.each do |task| Task.new(task) end end
display_all()
click to toggle source
# File lib/rubedility/task.rb, line 60 def self.display_all puts "\nAvailable Tasks: \n" self.all.each do |task| task.display_row end return nil end
new(task_row)
click to toggle source
# File lib/rubedility/task.rb, line 4 def initialize(task_row) add_task_attributes(task_row) @@all.push(self) end
user_display_one()
click to toggle source
# File lib/rubedility/task.rb, line 34 def self.user_display_one print "Enter Task Name:" input = gets.strip.downcase self.all.each do |task| if task.name.downcase==input task.display_content return nil end end self.display_all puts "Try better next time." end
Public Instance Methods
add_task_attributes(attributes_hash)
click to toggle source
# File lib/rubedility/task.rb, line 17 def add_task_attributes(attributes_hash) if attributes_hash == nil return end attributes_hash.each do |key, val| self.send(("#{key}="), val) if key.to_s == "difficulty" d = Difficulty.find_or_create(val) d.add_task(self) end end end
display_content()
click to toggle source
# File lib/rubedility/task.rb, line 52 def display_content puts "=========================================" puts "==========#{self.name}==========" puts "=========================================" puts "Difficulty: #{self.difficulty}" puts @content end
display_row()
click to toggle source
# File lib/rubedility/task.rb, line 47 def display_row puts "=#{self.name}= (#{self.difficulty})" puts "#{self.tagline}\n\n" end