Class: ParagraphText

Inherits:
Object
  • Object
show all
Includes:
Lengthable
Defined in:
lib/ipsummer/paragraph_text.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Lengthable

#length, #length_max, #length_min, #max_no_min?, #min_and_max?, #min_no_max?

Constructor Details

#initialize(options = {}) ⇒ ParagraphText

Returns a new instance of ParagraphText.



9
10
11
12
# File 'lib/ipsummer/paragraph_text.rb', line 9

def initialize(options={})
  @min = options[:min_sentences]
  @max = options[:max_sentences]
end

Instance Attribute Details

#maxObject (readonly)

Returns the value of attribute max.



7
8
9
# File 'lib/ipsummer/paragraph_text.rb', line 7

def max
  @max
end

#minObject (readonly)

Returns the value of attribute min.



7
8
9
# File 'lib/ipsummer/paragraph_text.rb', line 7

def min
  @min
end

Instance Method Details

#textObject



14
15
16
# File 'lib/ipsummer/paragraph_text.rb', line 14

def text
  sentences.first(length).join('. ') + '.'
end