Module: Scruffy::Helpers::Canvas

Included in:
Components::Viewport, Renderers::Base
Defined in:
lib/scruffy/helpers/canvas.rb

Overview

Scruffy::Helpers::Canvas

Author

Brasten Sager

Date

August 16th, 2006

Provides common methods for canvas objects. Primarily used for providing spacial-type calculations where necessary.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



11
12
13
# File 'lib/scruffy/helpers/canvas.rb', line 11

def components
  @components
end

Instance Method Details

#component(id, components = self.components) ⇒ Object



17
18
19
# File 'lib/scruffy/helpers/canvas.rb', line 17

def component(id, components=self.components)
  components.find {|elem| elem.id == id}
end

#remove(id, components = self.components) ⇒ Object



21
22
23
# File 'lib/scruffy/helpers/canvas.rb', line 21

def remove(id, components=self.components)
  components.delete(component(id))
end

#reset_settings!Object



13
14
15
# File 'lib/scruffy/helpers/canvas.rb', line 13

def reset_settings!
  self.options = {}
end