Class: WindowTypes::Window

Inherits:
Object
  • Object
show all
Defined in:
lib/wx_sugar/xrc/xrc2ruby_types/windows.rb

Direct Known Subclasses

Button

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.inherited(kls) ⇒ Object



18
19
20
# File 'lib/wx_sugar/xrc/xrc2ruby_types/windows.rb', line 18

def self.inherited(kls)
  @init_args.each { | arg, proc | kls.init_arg(arg, &proc) }
end

.init_arg(arg_name, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/wx_sugar/xrc/xrc2ruby_types/windows.rb', line 7

def self.init_arg(arg_name, &block)
  attr_writer arg_name
  define_method(arg_name) do
    if val = instance_variable_get("@#{arg_name}")
      block.call(val)
    end
  end
  @init_args ||= {}
  @init_args[arg_name] = block
end

.init_argsObject



3
4
5
# File 'lib/wx_sugar/xrc/xrc2ruby_types/windows.rb', line 3

def self.init_args
  @init_args 
end

Instance Method Details

#argsObject



35
36
37
38
39
40
41
42
43
# File 'lib/wx_sugar/xrc/xrc2ruby_types/windows.rb', line 35

def args
  defined_args = []
  self.class.init_args.keys.each do | arg |
    if arg_val = send(arg)
      defined_args << ":#{arg} => #{arg_val}"
    end
  end
  defined_args.join(",\n")
end