Class: WikiDiff

Inherits:
Object
  • Object
show all
Defined in:
app/models/wiki_page.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(content_to, content_from) ⇒ WikiDiff

Returns a new instance of WikiDiff



141
142
143
144
145
146
147
148
149
# File 'app/models/wiki_page.rb', line 141

def initialize(content_to, content_from)
  @content_to = content_to
  @content_from = content_from
  @words = content_to.text.split(/(\s+)/)
  @words = @words.select {|word| word != ' '}
  words_from = content_from.text.split(/(\s+)/)
  words_from = words_from.select {|word| word != ' '}    
  @diff = words_from.diff @words
end

Instance Attribute Details

#content_fromObject (readonly)

Returns the value of attribute content_from



139
140
141
# File 'app/models/wiki_page.rb', line 139

def content_from
  @content_from
end

#content_toObject (readonly)

Returns the value of attribute content_to



139
140
141
# File 'app/models/wiki_page.rb', line 139

def content_to
  @content_to
end

#diffObject (readonly)

Returns the value of attribute diff



139
140
141
# File 'app/models/wiki_page.rb', line 139

def diff
  @diff
end

#wordsObject (readonly)

Returns the value of attribute words



139
140
141
# File 'app/models/wiki_page.rb', line 139

def words
  @words
end