class WolfTrans::Context::MapEvent

Attributes

command_name[R]
event_num[R]
line_num[R]
map_name[R]
page_num[R]

Public Class Methods

from_data(map_name, event, page, cmd_index, command) click to toggle source
# File lib/wolftrans/context.rb, line 60
def self.from_data(map_name, event, page, cmd_index, command)
  MapEvent.new(map_name, event.id, page.id + 1, cmd_index + 1, command.class.name.split('::').last)
end
from_string(path) click to toggle source
# File lib/wolftrans/context.rb, line 64
def self.from_string(path)
  map_name, events_str, event_num, pages_str, page_num, line_num, command_name = path
  if events_str != 'events' || pages_str != 'pages'
    raise "unexpected path element in MPS context line"
  end
  MapEvent.new(map_name, event_num.to_i, page_num.to_i, line_num.to_i, command_name)
end
new(map_name, event_num, page_num, line_num, command_name) click to toggle source
# File lib/wolftrans/context.rb, line 37
def initialize(map_name, event_num, page_num, line_num, command_name)
  @map_name = map_name
  @event_num = event_num
  @page_num = page_num
  @line_num = line_num
  @command_name = command_name
end

Public Instance Methods

eql?(other) click to toggle source
Calls superclass method WolfTrans::Context#eql?
# File lib/wolftrans/context.rb, line 45
def eql?(other)
  super &&
    @map_name == other.map_name &&
    @event_num == other.event_num &&
    @page_num == other.page_num
end
hash() click to toggle source
# File lib/wolftrans/context.rb, line 52
def hash
  [@map_name, @event_num, @page_num].hash
end
to_s() click to toggle source
# File lib/wolftrans/context.rb, line 56
def to_s
  "MPS:#{@map_name}/events/#{@event_num}/pages/#{@page_num}/#{@line_num}/#{@command_name}"
end