Class: Compass::Magick::Command
- Inherits:
-
Object
- Object
- Compass::Magick::Command
- Includes:
- Scriptable, Utils
- Defined in:
- lib/magick/command.rb
Overview
A class that executes a block on a Canvas object.
When a function is called in a Sass document, it delays its execution until placed within a canvas. To do so, it must store state and return a valid Sass node.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#block ⇒ Proc
readonly
The block to execute.
Attributes included from Scriptable
Instance Method Summary collapse
-
#initialize(&block) ⇒ Command
constructor
Initializes a new Command instance.
-
#to_s(options = {}) ⇒ Object
Raises an error if the command is used outside of a Canvas object.
Methods included from Utils
#assert_one_of, #assert_type, #to_canvas, #to_chunky_color, #value_of
Constructor Details
#initialize(&block) ⇒ Command
Initializes a new Command instance.
20 21 22 |
# File 'lib/magick/command.rb', line 20 def initialize(&block) @block = block end |
Instance Attribute Details
#block ⇒ Proc (readonly)
Returns The block to execute.
25 26 27 |
# File 'lib/magick/command.rb', line 25 def block @block end |
Instance Method Details
#to_s(options = {}) ⇒ Object
Raises an error if the command is used outside of a Compass::Magick::Canvas object.
28 29 30 |
# File 'lib/magick/command.rb', line 28 def to_s( = {}) raise NotAllowed.new("#{self.class} cannot be used outside of a Compass::Magick::Canvas object") end |