Class: SwfRuby::Swf::ActionRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/swf_ruby/swf/action_record.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag) ⇒ ActionRecord

Returns a new instance of ActionRecord.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/swf_ruby/swf/action_record.rb', line 10

def initialize(tag)
  tag.force_encoding("ASCII-8BIT") if tag.respond_to? :force_encoding
  # action code
  @code = tag[0].chr.unpack("C").first
  # length (including action record header) and data
  @length = 1
  @data = nil
  if @code >= 0x80
    len = tag[1,2].unpack("v").first
    @length += len + 2
    @data = tag[3,len]
  end
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



6
7
8
# File 'lib/swf_ruby/swf/action_record.rb', line 6

def code
  @code
end

#dataObject (readonly)

Returns the value of attribute data.



8
9
10
# File 'lib/swf_ruby/swf/action_record.rb', line 8

def data
  @data
end

#lengthObject (readonly)

Returns the value of attribute length.



7
8
9
# File 'lib/swf_ruby/swf/action_record.rb', line 7

def length
  @length
end