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
⚙ /export/level_up_exercises/dino_catalog (master) > cd /export/ | |
⚙ /export > cd level_up | |
// this is home | |
⚙ /export/level_up (master) > cd ~ | |
⚙ ~ > pwd | |
/Users/jmastey |
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
locus1 = ["E","e"] | |
locus2 = ["A","A+","At","a"] | |
zombie_locus = ["prl", "n"] | |
real_genes = [ | |
["G","g"], | |
["Cr","n"], | |
["D","d"], | |
["Ch","n"], | |
["prl","n"], //interacts with locus4; see notes |
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
[1,2,3] |
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
def philosophize(thinker, thoughts) | |
return unless thinker.is_a? Philosopher | |
if thoughts.kind_of? Array | |
thoughts.map { |thought| thinker.think(thought) } | |
else | |
thinker.think(thought) # => <thought ...> | |
end | |
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
def revolutionize_industry | |
taken_ideas = philosophize(thinker, ideas) | |
if !taken_ideas.nil? | |
taken_ideas.each do |idea| | |
publish(idea) | |
end | |
end | |
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
def philosophize(thinker, thoughts) | |
return unless thinker.is_a? Philosopher | |
thoughts = [thoughts] unless thoughts.kind_of? Array | |
thoughts.map do |thought| | |
thinker.think(thought) | |
end | |
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
def philosophize(thinker, thoughts) | |
raise ArgumentError unless thinker.is_a? Philosopher | |
thoughts = [thoughts] unless thoughts.kind_of? Array | |
thoughts.map do |thought| | |
thinker.think(thought) | |
end | |
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
def philosophize(thinker, thoughts) | |
raise ArgumentError unless thinker.is_a? Philosopher | |
Array(thoughts).map do |thought| | |
thinker.think(thought) | |
end | |
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
[11] pry(Kernel):1> ls -m --grep=^[A-Z] | |
Kernel.methods: Array Complex Float Hash Integer Pathname Rational String |
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
Array(nil) # => [] | |
Array(1) # => [1] | |
Array([3]) # => [3] | |
class ArrayLikeThing | |
def to_a | |
[1, 2, 3] | |
end |