Class: WikiDiff

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

Instance Attribute Summary

Instance Method Summary

Constructor Details

- (WikiDiff) initialize(content_to, content_from)

A new instance of WikiDiff



146
147
148
149
150
151
152
153
154
# File 'app/models/wiki_page.rb', line 146

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

- (Object) content_from (readonly)

Returns the value of attribute content_from



144
145
146
# File 'app/models/wiki_page.rb', line 144

def content_from
  @content_from
end

- (Object) content_to (readonly)

Returns the value of attribute content_to



144
145
146
# File 'app/models/wiki_page.rb', line 144

def content_to
  @content_to
end

- (Object) diff (readonly)

Returns the value of attribute diff



144
145
146
# File 'app/models/wiki_page.rb', line 144

def diff
  @diff
end

- (Object) words (readonly)

Returns the value of attribute words



144
145
146
# File 'app/models/wiki_page.rb', line 144

def words
  @words
end