Class: Transpec::Record

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

Constant Summary collapse

OVERRIDDE_FORBIDDEN_METHODS =
[
  :original_syntax,
  :original_syntax_type,
  :converted_syntax,
  :converted_syntax_type
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Record.



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

def initialize(original_syntax, converted_syntax, annotation = nil)
  @original_syntax_type = original_syntax.to_sym
  @converted_syntax_type = converted_syntax.to_sym
  @annotation = annotation
end

Instance Attribute Details

#annotationObject (readonly)

Returns the value of attribute annotation.



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

def annotation
  @annotation
end

#converted_syntax_typeObject (readonly)

Returns the value of attribute converted_syntax_type.



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

def converted_syntax_type
  @converted_syntax_type
end

#original_syntax_typeObject (readonly)

Returns the value of attribute original_syntax_type.



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

def original_syntax_type
  @original_syntax_type
end

Instance Method Details

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



38
39
40
41
42
# File 'lib/transpec/record.rb', line 38

def ==(other)
  self.class == other.class &&
    original_syntax_type == other.original_syntax_type &&
    converted_syntax_type == other.converted_syntax_type
end

#converted_syntaxObject



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

def converted_syntax
  converted_syntax_type.to_s
end

#hashObject



46
47
48
# File 'lib/transpec/record.rb', line 46

def hash
  original_syntax_type.hash ^ converted_syntax_type.hash
end

#original_syntaxObject



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

def original_syntax
  original_syntax_type.to_s
end

#to_sObject



50
51
52
# File 'lib/transpec/record.rb', line 50

def to_s
  "`#{original_syntax_type}` -> `#{converted_syntax_type}`"
end