Method: PgGraph::Reflector#initialize
- Defined in:
- lib/pg_graph/reflector.rb
#initialize(reflections = [], default_reflections: Reflector.default_reflections) ⇒ Reflector
Returns a new instance of Reflector.
115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/pg_graph/reflector.rb', line 115 def initialize(reflections = [], default_reflections: Reflector.default_reflections) constrain reflections, [Reflection] # @reflection maps from number of reflection components to list of reflections. The # keys are initially created in descending to ensure that #values return # lists of components sorted from most to least specific. New reflections # are inserted at the beginning of the lists to make it possible to # override ealier reflections @reflections = {} (1..4).to_a.reverse.each { |components| @reflections[components] = [] } add(default_reflections || []) add(reflections) end |