Last active
August 29, 2015 14:03
-
-
Save mrsweaters/3e6ff7f9d136144d0745 to your computer and use it in GitHub Desktop.
Ruby Classe Stuff
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
| names = [] | |
| @topics.each do |topic| | |
| names << topic.name | |
| end | |
| names | |
| names = @topics.map do |topic| | |
| topic.name | |
| end | |
| @topics.map(&:name) | |
| class Topic | |
| def initialize(opts) | |
| @name = opts[:name] | |
| appendage = opts[:appendage] | |
| end | |
| def self.wow | |
| 'not wow' | |
| end | |
| def self.recent_topics | |
| where('created_at > ?', 1.day.ago) | |
| end | |
| def name | |
| @name | |
| end | |
| end | |
| t = Topic.recent_topics.first | |
| t.name | |
| topic = Topic.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment