Class: WikiDiff

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

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (WikiDiff) initialize(content_to, content_from)

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

- (Object) content_from (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

- (Object) content_to (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

- (Object) diff (readonly)

Returns the value of attribute diff



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

def diff
  @diff
end

- (Object) words (readonly)

Returns the value of attribute words



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

def words
  @words
end