Method: Megam::SnapshotsCollection#lookup

Defined in:
lib/megam/core/snapshots_collection.rb

#lookup(snapshots) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/megam/core/snapshots_collection.rb', line 73

def lookup(snapshots)
  lookup_by = nil
  if events.kind_of?(Megam::Snapshots)
  lookup_by = snapshots.
elsif snapshots.kind_of?(String)
  lookup_by = snapshots
  else
    raise ArgumentError, "Must pass a Megam::Snapshots or String to lookup"
  end
  res = @snapshots_by_name[lookup_by]
  unless res
    raise ArgumentError, "Cannot find a node matching #{lookup_by} (did you define it first?)"
  end
  @snapshots[res]
end