Created
May 4, 2019 02:50
-
-
Save chron/38cd56b83890b00ad427e0e634a78f4b to your computer and use it in GitHub Desktop.
Development Faculty Vision Generator 1.0
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 Grammar | |
class << self | |
attr_reader :rules | |
def method_missing(method, *args, &block) | |
@rules ||= Hash.new { |h,k| h[k] = [] } | |
@rules[method] += [*args, block].flatten.compact | |
end | |
end | |
def method_missing(method, *args) | |
if self.class.rules.key?(method) | |
possible_rules = self.class.rules[method] | |
rule = possible_rules.sample | |
possible_rules.delete(rule) | |
raise "#{method} ran out of template strings" if rule.nil? | |
rule.is_a?(Proc) ? instance_eval(&rule) : rule | |
else | |
super | |
end | |
end | |
end | |
class DevelopmentVision < Grammar | |
root { "A #{team_qualities} #{group} of #{individual_qualities} #{people} #{mission}." } | |
team_qualities { "#{team_adjective}" } | |
team_qualities { "#{team_adjective} and #{team_adjective}" } | |
team_qualities { "#{team_adjective}, #{team_adjective} and #{team_adjective}" } | |
team_adjective 'diverse', 'distributed', 'supportive', 'fault-tolerant' | |
group 'group', 'team', 'network', 'family' | |
individual_qualities { "#{individual_adjective}" } | |
individual_qualities { "#{individual_adjective} and #{individual_adjective}" } | |
individual_qualities { "#{individual_adjective}, #{individual_adjective} and #{individual_adjective}" } | |
individual_adjective 'curious', 'technically-minded', 'clever', 'brilliant', 'innovative' | |
people 'individuals', 'people', 'hackers', 'developers', 'humans' | |
mission { "#{verbing} the #{technology} #{powering} #{product}" } | |
verbing 'driving', 'delivering', 'producing', 'owning', 'creating', 'stewarding', 'supporting', 'coding' | |
technology 'technology', 'tech', 'platform', 'stack', 'engine', 'brains' | |
powering 'behind', 'powering', 'responsible for', 'bringing you', 'that gives you', 'that brings you', 'that delivers' | |
product { "#{place}'s favourite #{ux} brand" } | |
product { "next-level #{ux}" } | |
product { "#{ux} of the future" } | |
product 'Optimal Workshop' | |
product { "cutting-edge #{ux}" } | |
product 'a wealthier Andrew Mayfield', "Gregory's cocaine addiction" | |
place 'New Zealand', 'the world' | |
ux 'UX', 'user experience', 'user research' | |
end | |
if __FILE__ == $0 | |
vision = DevelopmentVision.new | |
puts vision.root | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment