Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Lab
- def call
- [
- * (parenthesize(foo) if fooable?),
- * (parenthesize(bar) if barable?),
- ] * " "
- end
- private
- def foo; "foo"; end
- def fooable?; true; end
- def bar; "bar"; end
- def barable?; true; end
- def parenthesize(text); "(#{text})"; end
- end
- p Lab.new.call # "(foo) (bar)"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement