class CustomObject
Public Class Methods
newObject(name)
click to toggle source
# File lib/pdep.rb, line 5 def self.newObject(name) instance = self.new self.register_instance_name(instance, name) Object.const_set(name, instance) end
Private Class Methods
get_instance_name(instance)
click to toggle source
# File lib/pdep.rb, line 35 def self.get_instance_name(instance) @@object_name_register[instance] end
register_instance_name(instance, name)
click to toggle source
# File lib/pdep.rb, line 31 def self.register_instance_name(instance, name) @@object_name_register[instance] = name end
Public Instance Methods
__trompita__()
click to toggle source
# File lib/pdep.rb, line 20 def __trompita__ puts ".>> <3 <<." end
attr_accessor(*many_attributes)
click to toggle source
# File lib/pdep.rb, line 16 def attr_accessor(*many_attributes) many_attributes.each { |symbol| self.singleton_class.send(:attr_accessor, symbol) } end
define(&block)
click to toggle source
# File lib/pdep.rb, line 11 def define(&block) self.instance_eval(&block) self.initialize unless !self.respond_to? :initialize end
to_s()
click to toggle source
# File lib/pdep.rb, line 24 def to_s to_string = "#{self.class.get_instance_name(self)}{" self.instance_variables.each { |variable| to_string += " #{variable[1..-1]}: #{self.instance_variable_get(variable)}" } to_string = to_string[0..-1] + "}" end