Module: Vizier::Support::Finder

Defined in:
lib/support/vizier.rb

Instance Method Summary collapse

Instance Method Details

#[](idx) ⇒ Object



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/support/vizier.rb', line 46

def []( idx )
  begin
    super( idx )
  rescue TypeError => e
    if idx.is_a?( String ) || idx.is_a?( Symbol )
      self.detect { |i| i.name.to_s == idx.to_s }
    elsif idx.class.respond_to?(:table_name)
      self.detect { |i| i.name.to_s == Vizier::Node.make_name( idx ) }
    else
      raise e
    end
  end
end