Class: SciolyFF::Interpreter::Model

Inherits:
Object
  • Object
show all
Defined in:
lib/sciolyff/interpreter/model.rb

Overview

Parent class for other nested classes within Interpreter

Direct Known Subclasses

Event, Penalty, Placing, Team, Tournament

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(rep, index) ⇒ Model

Returns a new instance of Model.



6
7
8
# File 'lib/sciolyff/interpreter/model.rb', line 6

def initialize(rep, index)
  @rep = rep[pluralize_for_key(self.class)][index]
end

Instance Attribute Details

#tournamentObject (readonly)

Returns the value of attribute tournament.



14
15
16
# File 'lib/sciolyff/interpreter/model.rb', line 14

def tournament
  @tournament
end

Instance Method Details

#inspectObject

prevents infinite loop due caused by intentional circular references



17
18
19
# File 'lib/sciolyff/interpreter/model.rb', line 17

def inspect
  to_s.delete_suffix('>') + " @rep=#{@rep}>"
end


10
11
12
# File 'lib/sciolyff/interpreter/model.rb', line 10

def link_to_other_models(interpreter)
  @tournament = interpreter.tournament
end