Class: Zpl::Command
- Inherits:
-
Object
- Object
- Zpl::Command
- Defined in:
- lib/zpl-transformer/command.rb
Overview
Data class that holds the name & params of a ZPL command.
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(name, params = []) ⇒ Command
constructor
A new instance of Command.
-
#to_zpl_string ⇒ Object
Converts the command to a ZPL string.
Constructor Details
#initialize(name, params = []) ⇒ Command
Returns a new instance of Command.
8 9 10 11 |
# File 'lib/zpl-transformer/command.rb', line 8 def initialize(name, params = []) @name = name @params = params end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/zpl-transformer/command.rb', line 5 def name @name end |
#params ⇒ Object
Returns the value of attribute params.
6 7 8 |
# File 'lib/zpl-transformer/command.rb', line 6 def params @params end |
Instance Method Details
#to_zpl_string ⇒ Object
Converts the command to a ZPL string.
14 15 16 |
# File 'lib/zpl-transformer/command.rb', line 14 def to_zpl_string "^#{ @name }#{ @params.join(',') }" end |