Method: ASSFile#initialize

Defined in:
lib/vtt2ass/ass_file.rb

#initialize(title, width, height, css_file_path = nil) ⇒ ASSFile

Creates a new ASSFile instance and assigns the default values of instance variables.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/vtt2ass/ass_file.rb', line 15

def initialize(title, width, height, css_file_path = nil)
    @width = width
    @height = height
    if not css_file_path.nil? then
        @css_file = CSSFile.new(css_file_path)
    end
    @header = [
        '[Script Info]',
        "Title: #{title}",
        'ScriptType: v4.00+',
        'Collisions: Normal',
        'PlayDepth: 0',
        "PlayResX: #{@width}",
        "PlayResY: #{@height}",
        'WrapStyle: 0',
        'ScaledBorderAndShadow: yes',
        '',
        '[V4+ Styles]',
        'Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding'
    ]
    @events = [
        '',
        '[Events]',
        'Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text'
    ]
    @ass_styles = []
    @ass_lines = []
end