Class: Painter::Operation
- Inherits:
-
Object
- Object
- Painter::Operation
- Defined in:
- lib/painter/operation.rb
Class Method Summary collapse
Instance Method Summary collapse
- #_angle ⇒ Object
- #_color ⇒ Object
- #angle(n) ⇒ Object
- #color(r, g, b, a = nil) ⇒ Object
-
#initialize(i) ⇒ Operation
constructor
A new instance of Operation.
Constructor Details
#initialize(i) ⇒ Operation
Returns a new instance of Operation.
16 17 18 |
# File 'lib/painter/operation.rb', line 16 def initialize(i) @image = i end |
Class Method Details
.pretty_accessor(*names) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/painter/operation.rb', line 3 def self.pretty_accessor(*names) names.each do |n| attr_reader n.to_sym class_eval <<-END def #{n}(v) @_#{n} = v end def _#{n} @_#{n} end END end end |
Instance Method Details
#_angle ⇒ Object
34 35 36 |
# File 'lib/painter/operation.rb', line 34 def _angle @_angle || 0 end |
#_color ⇒ Object
41 42 43 |
# File 'lib/painter/operation.rb', line 41 def _color @_color || Painter::Color.new(1, 1, 1) end |
#angle(n) ⇒ Object
30 31 32 |
# File 'lib/painter/operation.rb', line 30 def angle(n) @_angle = (n * Math::PI / 180.0) end |