A book for a Mage: the Awakened game set in a cyberpunk dystopia.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
946B

  1. class String
  2. PUNCTUATION_MARKS = [".", "!", "?"]
  3. def titleize
  4. gsub(/\w+/i) do |match|
  5. ret = match.downcase
  6. ret[0] = ret[0].upcase
  7. ret
  8. end
  9. end
  10. def titleize!
  11. replace titleize
  12. end
  13. def punctuated?
  14. PUNCTUATION_MARKS.include?(self[-1])
  15. end
  16. def unpunctuated?
  17. !punctuated?
  18. end
  19. end
  20. class Integer
  21. def to_dots
  22. "•" * self
  23. end
  24. end
  25. class Object
  26. def arrayify
  27. [self]
  28. end
  29. end
  30. class Array
  31. def arrayify
  32. self
  33. end
  34. def to_list(separator: nil)
  35. separator = "and" if separator.nil?
  36. if self.length == 0
  37. nil
  38. elsif self.length == 1
  39. self.first
  40. elsif self.length == 2
  41. "#{self.first} #{separator} #{self.last}"
  42. else
  43. ret = clone
  44. ret[ret.length - 1] = "#{separator} #{ret[ret.length - 1]}"
  45. ret.join(", ")
  46. end
  47. end
  48. def to_arcanum_with_dots
  49. "#{self[0].to_s.titleize} #{self[1].to_dots}"
  50. end
  51. end