2015-07-13 22:11:00 +02:00
|
|
|
|
|
|
|
class ObjectView
|
|
|
|
|
|
|
|
attr_accessor :text , :object , :attributes
|
|
|
|
|
|
|
|
def initialize o
|
|
|
|
super()
|
|
|
|
puts "NO O " unless o
|
|
|
|
self.object = o
|
2015-07-15 18:26:11 +02:00
|
|
|
self.text = short
|
2015-07-13 22:11:00 +02:00
|
|
|
@attributes = {}
|
|
|
|
end
|
|
|
|
|
2015-07-14 12:07:28 +02:00
|
|
|
def short
|
|
|
|
object.class.name.split("::").last[0 .. 3]
|
|
|
|
end
|
|
|
|
|
|
|
|
def is_parfait
|
|
|
|
object.class.name.split("::").first == "Parfait"
|
|
|
|
end
|
2015-07-13 22:11:00 +02:00
|
|
|
def set name , val
|
|
|
|
@attributes[name] = val
|
2015-07-14 12:07:28 +02:00
|
|
|
self.text.text = short + @attributes.length.to_s
|
2015-07-13 22:11:00 +02:00
|
|
|
end
|
|
|
|
def get(name)
|
|
|
|
@attributes[name]
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|