Class: Linker

Inherits:
Object
  • Object
show all
Defined in:
lib/ipsummer/linker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Linker

Returns a new instance of Linker.



4
5
6
7
# File 'lib/ipsummer/linker.rb', line 4

def initialize(options={})
  @paragraph_text = options[:paragraph_text]
  @wrapper = options[:wrapper]
end

Instance Attribute Details

#paragraph_textObject

Returns the value of attribute paragraph_text.



2
3
4
# File 'lib/ipsummer/linker.rb', line 2

def paragraph_text
  @paragraph_text
end

#wrapperObject

Returns the value of attribute wrapper.



2
3
4
# File 'lib/ipsummer/linker.rb', line 2

def wrapper
  @wrapper
end

Instance Method Details

#linked_paragraphObject



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

def linked_paragraph
  phrases.map { |phrase| phrase_with_link phrase }.join(' ').gsub(/\w\z/, 't.')
end