module Demoman

Handles static creation of {DemoFile} objects

Constants

VERSION

The current version of the demoman gem.

Public Class Methods

from_file(file) click to toggle source

Create a {DemoFile} object from a file path

@param file [String] the path to the .dem file.

@return [DemoFile]

# File lib/demoman.rb, line 13
def self.from_file(file)
  io = File.new(file, "r")
  data = io.sysread(4096)

  Demoman.from_string(data)
end
from_string(data) click to toggle source

Create a {DemoFile} object from a raw string

@param data [String] the raw demo file data

@return [DemoFile]

# File lib/demoman.rb, line 25
def self.from_string(data)
  demo = DemoFile.new
  demo.parse_data(data)
  demo
end