Class: Pronto::Formatter::GithubStatusFormatter::Sentence
- Inherits:
-
Object
- Object
- Pronto::Formatter::GithubStatusFormatter::Sentence
- Defined in:
- lib/pronto/formatter/github_status_formatter/sentence.rb
Instance Method Summary collapse
-
#initialize(words) ⇒ Sentence
constructor
A new instance of Sentence.
- #to_s ⇒ Object
Constructor Details
#initialize(words) ⇒ Sentence
Returns a new instance of Sentence.
5 6 7 |
# File 'lib/pronto/formatter/github_status_formatter/sentence.rb', line 5 def initialize(words) @words = words end |
Instance Method Details
#to_s ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/pronto/formatter/github_status_formatter/sentence.rb', line 9 def to_s case words.size when 0 '' when 1 words[0].to_s.dup when 2 "#{words[0]}#{WORD_CONNECTORS[:two_words_connector]}#{words[1]}" else to_oxford_comma_sentence end end |