Class: Cheep::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/object.rb

Overview

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at mozilla.org/MPL/2.0/.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, num, *args) ⇒ Object



8
9
10
11
12
13
# File 'lib/object.rb', line 8

def initialize(name, num, *args)
  @name = name
  @args = args
  @num = num
  @ins = []
end

Instance Attribute Details

#insObject (readonly)

Returns the value of attribute ins.



6
7
8
# File 'lib/object.rb', line 6

def ins
  @ins
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/object.rb', line 6

def name
  @name
end

#numObject (readonly)

Returns the value of attribute num.



6
7
8
# File 'lib/object.rb', line 6

def num
  @num
end

Instance Method Details

#[](*args) ⇒ Object



20
21
22
23
# File 'lib/object.rb', line 20

def [](*args)
  @ins = args
  self
end

#to_patchObject



15
16
17
18
# File 'lib/object.rb', line 15

def to_patch
  name = @name.to_s.sub '!', '~'
  { @num => "#X obj 0 0 #{name} #{@args.join ' ' }".strip << ';' }
end