module Joint class AttachmentProxy def initialize(instance, name) @instance, @name = instance, name end def id @instance.send("#{@name}_id") end def name @instance.send("#{@name}_name") end def size @instance.send("#{@name}_size") end def type @instance.send("#{@name}_type") end def nil? !@instance.send("#{@name}?") end def grid_io @grid_io ||= @instance.grid.get(id) end def method_missing(method, *args, &block) grid_io.send(method, *args, &block) end end end