Class: Zpl::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/zpl-transformer/command.rb

Overview

Data class that holds the name & params of a ZPL command.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/zpl-transformer/command.rb', line 5

def name
  @name
end

#paramsObject

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_stringObject

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