This file contains 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 PrimeFactors | |
def self.generate(number) | |
if number == 1 | |
[] | |
elsif number <= 3 | |
[number] | |
else | |
result = [] | |
Array((2..number / 2)).each do |i| | |
while(number % i).zero? do |
This file contains 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 Game | |
def self.play | |
(1..100).map { |n| Kid.answer_to(n) } | |
end | |
class Kid | |
def self.answer_to(number) | |
if (number % 15).zero? | |
"FizzBuzz" | |
elsif (number % 3).zero? |
This file contains 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 run_unit_test(file) | |
system("php5 symfony test:unit #{file}") | |
end | |
def run_functional_test(app, controller) | |
system("php5 symfony test:functional #{app} #{controller}Actions") | |
end | |
def build_schema | |
system("php5 symfony doctrine:build --all-classes") |
NewerOlder