class WolfTrans::Context

Represents the context of a translatable string

Public Class Methods

from_string(string) click to toggle source

Parse a string to determine context

# File lib/wolftrans/context.rb, line 9
def self.from_string(string)
  pair = string.split(':', 2)
  if pair.size != 2
    raise "malformed context line"
  end
  type, path = pair
  path = path.split('/')

  case type
  when 'MPS'
    return MapEvent.from_string(path)
  when 'GAMEDAT'
    return GameDat.from_string(path)
  when 'DB'
    return Database.from_string(path)
  when 'COMMONEVENT'
    return CommonEvent.from_string(path)
  end
  raise "unrecognized context type '#{type}'"
end

Public Instance Methods

eql?(other) click to toggle source
# File lib/wolftrans/context.rb, line 4
def eql?(other)
  self.class == other.class
end