Class/Module Index [+]

Quicksearch

Goo::PropsInit

Public Class Methods

append_features(klass) click to toggle source
# File goocanvas/lib/goocanvas.rb, line 34
def self.append_features(klass)
  super
  arity = klass.instance_method(:initialize).arity
  raise 'the initialize method of a class including PropsInit must have a fixed arity' if arity < 0
  args_list = (1..arity).collect { |i| "param#{i}" }.join(", ")
  klass.module_eval         alias :_initialize :initialize        def initialize(#{args_list}, *args)          _initialize(#{args_list})          init_props(*args)        end                alias :_set_property :set_property        def set_property(prop_name, value)          pspec = self.class.property(prop_name)          value = value.to_goo if pspec.value_type.name =~ /^GooCairo/ and value.respond_to?(:to_goo)          _set_property(prop_name, value)        end        
end

Public Instance Methods

init_props(*args) click to toggle source
# File goocanvas/lib/goocanvas.rb, line 29
def init_props(*args)
  hash = Goo.args_to_hash(args)
  hash.each_pair { |key, value| set_property(key.to_s.gsub(/-/, '_').to_sym, value) }
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.