Joe Armstrong
Fred Brooks
class Engine::Docs
def self.default_list(project)
if Engine.early?(project)
Engine::Docs::EarlyList.build(project)
else
Engine::Docs::List.build(project)
end
end
end
class Engine
def self.docs(project)
Docs.default_list(project).map(&:slug)
end
def self.early?(project)
project.maturity.in? Engine::Project::EARLY_MATURITIES
end
end
int countSubstring(const char *str, const char *sub)
{
int length = strlen(sub);
if (length == 0) return 0;
int count = 0;
for (str = strstr(str, sub); str; str = strstr(str + length, sub))
++count;
return count;
}
def countSubstrings(str, sub)
str.scan(sub).length
end