T-10 to HW Due

  • Finishing EventManager
    • The send method is a great way to send arguments into a method that you define to act as names of a method that already exists, for instance:
      • object = "upcase me!"
      • method = "upcase"
      • object.send(method.to_sym) # => "UPCASE ME!"
    • Usage of the Date method to scrape dates and times (ways to assign a string to a date object)
    • strings can go for multiple lines in code just by adding them together with addition signs
    • I found some online tips for how to show the frequency of an item in an array via a hash. The each method works, and my_hash[thing] += 1 will create a key for thing if it doesn’t exist, and will otherwise increment its value by 1.
      • There is some kind of difference between doing my_hash = {} and my_hash = Hash.new(0)
    • to get the day names, there is an array in the 'date' module containing the names of all the days of the week, accessed via Date::DAYNAMES, and using the index of the day wday method on a DateTime object
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s