Class: Openra::Replays::Replay
- Inherits:
-
Object
- Object
- Openra::Replays::Replay
- Defined in:
- lib/openra/replays/replay.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #each_order(&block) ⇒ Object
- #file_hash ⇒ Object
-
#initialize(filename) ⇒ Replay
constructor
A new instance of Replay.
- #metadata ⇒ Object
- #player(index) ⇒ Object
- #players ⇒ Object
Constructor Details
Instance Attribute Details
#file ⇒ Object (readonly)
Returns the value of attribute file.
6 7 8 |
# File 'lib/openra/replays/replay.rb', line 6 def file @file end |
Instance Method Details
#each_order(&block) ⇒ Object
22 23 24 |
# File 'lib/openra/replays/replay.rb', line 22 def each_order(&block) file.each_order(&block) end |
#file_hash ⇒ Object
12 13 14 |
# File 'lib/openra/replays/replay.rb', line 12 def file_hash file.generate_hash end |
#metadata ⇒ Object
16 17 18 19 20 |
# File 'lib/openra/replays/replay.rb', line 16 def @metadata ||= Openra::Struct::Metadata.new( Openra::MiniYAML.load(file..data) ) end |
#player(index) ⇒ Object
30 31 32 33 34 |
# File 'lib/openra/replays/replay.rb', line 30 def player(index) players.find do |candidate| candidate.client_index == index end end |
#players ⇒ Object
26 27 28 |
# File 'lib/openra/replays/replay.rb', line 26 def players .players end |