lib/ray/target.rb in ray-0.1.1 vs lib/ray/target.rb in ray-0.2.0

- old
+ new

@@ -1,18 +1,43 @@ module Ray class Target + include Ray::PP + + # Shader used when drawing on this target + # + # Notice this method will always return the same object, and that modifying + # this object will modify the shader used internally be the target. + # # @return [Ray::Shader] Shader used when drawing on this target def shader @shader ||= simple_shader # must always remain the same object end + # @group Manipulating views + + # Changes the view temporarily + # # @param [Ray::View] view A new view # @yield a block where the view has been changed + # + # @example + # old_view = target.view + # target.with_view new_view do + # target.view == new_view # => true + # end + # + # target.view == old_view # => true def with_view(view) old_view = self.view self.view = view yield self ensure self.view = old_view + end + + # @endgroup + + def pretty_print(q, other_attr = []) + pretty_print_attributes q, ["view", "shader", "size"] + other_attr end end end