Class: Burn::Fuel::Telnet::Declare

Inherits:
DslBase
  • Object
show all
Defined in:
lib/burn/fuel/telnet/declare.rb

Instance Method Summary collapse

Methods included from Debug

#log

Constructor Details

#initialize(resource_name, context) ⇒ Declare

Returns a new instance of Declare.



6
7
8
# File 'lib/burn/fuel/telnet/declare.rb', line 6

def initialize(resource_name, context)
  super(resource_name, context)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_symbol, *args, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/burn/fuel/telnet/declare.rb', line 10

def method_missing(method_symbol, *args, &block)
  proc = Proc.new{|args|
    key=args.shift
    value=args.shift
    if value.is_a?(String) then
      @opcodes << "@___#{key} = Sprite.new(\"#{value}\",0,0)"
    else
      @opcodes << "@___#{key} = #{value}"
    end
  }

  @context.instance_exec [method_symbol.to_s, args[0]], &proc
end