Last active
February 27, 2020 15:09
-
-
Save ruuts/229c91ce40ceda3fa56fb4add1a1684f to your computer and use it in GitHub Desktop.
Join the team
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
module BookingExperts | |
class Team | |
def initialize | |
@team = [] | |
end | |
def self.build(&block) | |
new.tap do |team| | |
team.instance_eval(&block) | |
end | |
end | |
def add name, role, exp, education, tools | |
@team << Member.new(name, role, exp, education, tools) | |
end | |
def experience | |
puts "Average experience of #{@team.sum(&:exp) / @team.count} years" | |
end | |
def technology | |
puts @team.flat_map(&:tools).uniq.join(', ') | |
end | |
def education | |
puts @team.flat_map(&:education).uniq.join(', ') | |
end | |
def join; puts "Join the team, send your motivation to: dev@bookingexperts.nl"; end | |
end | |
class Member < Struct.new(:name, :role, :exp, :education, :tools) | |
end | |
end | |
team = BookingExperts::Team.build do | |
add 'Stefan', 'Back-end', 18, 'UT', %W(Ruby Rails Postgres React Elasticsearch) | |
add 'Rob', 'Back-end', 15, 'UT', %w(Ruby Rails AWS Elasticsearch) | |
add 'Gerjan', 'Back-end', 16, 'UT', %w(Ruby Rails Postgres) | |
add 'Eelco', 'Full-stack', 17, 'Saxion', %w(Ruby Rails Postgres) | |
add 'Thomas', 'Full-stack', 6, 'UT', %w(Ruby Rails React Typescript Elixir Phoenix) | |
add 'Arthur', 'DevOps', 21, 'UT', %w(Ruby Rails AWS Docker Elasticsearch Redis Postgres) | |
add 'Rob', 'Back-end', 9, 'UT', %w(Ruby) | |
add 'Rein', 'Full-stack', 19, 'UT', %w(Ruby Rails Postgres) | |
add 'Feyzullah', 'Back-end', 3, 'Saxion', %w(Ruby Rails) | |
add 'Mustafa', 'Product design', 5, 'UT', %w(Sketch Illustrator) | |
add 'Ruud', 'Full-stack', 11, nil, %W(Ruby Rails React) | |
end | |
team.source_code # => https://gist.github.com/ruuts/229c91ce40ceda3fa56fb4add1a1684f | |
team.experience # => Average experience of 12 years | |
team.technology # => Ruby, Rails, Postgres, React, Elasticsearch, AWS, Typescript, Elixir, Phoenix, Docker, Redis, Sketch, Illustrator | |
team.education # => UT, Saxion, nil | |
team.join # => Send your motivation to: dev@bookingexperts.nl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment