Class: Transpec::Record

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

Direct Known Subclasses

Syntax::Have::HaveRecord

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(original_syntax, converted_syntax) ⇒ Record

Returns a new instance of Record.



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

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

Instance Attribute Details

#converted_syntaxObject (readonly)

Returns the value of attribute converted_syntax.



5
6
7
# File 'lib/transpec/record.rb', line 5

def converted_syntax
  @converted_syntax
end

#original_syntaxObject (readonly)

Returns the value of attribute original_syntax.



5
6
7
# File 'lib/transpec/record.rb', line 5

def original_syntax
  @original_syntax
end

Instance Method Details

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



12
13
14
15
16
# File 'lib/transpec/record.rb', line 12

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

#hashObject



20
21
22
# File 'lib/transpec/record.rb', line 20

def hash
  original_syntax.hash ^ converted_syntax.hash
end

#to_sObject



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

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