Class: Transpec::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/transpec/record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original_syntax, converted_syntax, annotation = nil) ⇒ Record

Returns a new instance of Record.



9
10
11
12
13
# File 'lib/transpec/record.rb', line 9

def initialize(original_syntax, converted_syntax, annotation = nil)
  @original_syntax = original_syntax
  @converted_syntax = converted_syntax
  @annotation = annotation
end

Instance Attribute Details

#annotationObject (readonly)

Returns the value of attribute annotation.



7
8
9
# File 'lib/transpec/record.rb', line 7

def annotation
  @annotation
end

#converted_syntaxObject (readonly)

Returns the value of attribute converted_syntax.



7
8
9
# File 'lib/transpec/record.rb', line 7

def converted_syntax
  @converted_syntax
end

#original_syntaxObject (readonly)

Returns the value of attribute original_syntax.



7
8
9
# File 'lib/transpec/record.rb', line 7

def original_syntax
  @original_syntax
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



15
16
17
18
19
# File 'lib/transpec/record.rb', line 15

def ==(other)
  self.class == other.class &&
    original_syntax == other.original_syntax &&
    converted_syntax == other.converted_syntax
end

#hashObject



23
24
25
# File 'lib/transpec/record.rb', line 23

def hash
  original_syntax.hash ^ converted_syntax.hash
end

#to_sObject



27
28
29
# File 'lib/transpec/record.rb', line 27

def to_s
  "`#{original_syntax}` -> `#{converted_syntax}`"
end