Class: ArelConverter::Replacement

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/arel_converter/replacement.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(old_content = nil, new_content = nil) ⇒ Replacement

Returns a new instance of Replacement.



7
8
9
10
# File 'lib/arel_converter/replacement.rb', line 7

def initialize(old_content=nil, new_content=nil)
  @old_content = old_content
  @new_content = new_content
end

Instance Attribute Details

#errorObject

Returns the value of attribute error.



5
6
7
# File 'lib/arel_converter/replacement.rb', line 5

def error
  @error
end

#new_contentObject

Returns the value of attribute new_content.



5
6
7
# File 'lib/arel_converter/replacement.rb', line 5

def new_content
  @new_content
end

#old_contentObject

Returns the value of attribute old_content.



5
6
7
# File 'lib/arel_converter/replacement.rb', line 5

def old_content
  @old_content
end

Instance Method Details

#<=>(other) ⇒ Object



16
17
18
# File 'lib/arel_converter/replacement.rb', line 16

def <=>(other)
  [self.old_content, self.new_content] <=> [other.old_content, other.new_content]
end

#valid?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/arel_converter/replacement.rb', line 12

def valid?
  @error.nil?
end