Class: CTAPI::APDU
- Inherits:
-
Object
- Object
- CTAPI::APDU
- Defined in:
- lib/ctapi.rb
Overview
APDU (Application Protocol Data Unit) that is sent to/received from the cardterminal. This is the parent class of Command and Response.
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
This is the data string.
Instance Method Summary collapse
-
#[](*args) ⇒ Object
Access data string by indices.
-
#initialize(data) ⇒ APDU
constructor
An APDU object is generated from the String data.
-
#inspect ⇒ Object
We use Ruby’s inspect representation to inspect the data.
-
#to_s ⇒ Object
To display the data, a string of the form ‘12:23:a4’ is built.
Constructor Details
#initialize(data) ⇒ APDU
An APDU object is generated from the String data.
398 399 400 |
# File 'lib/ctapi.rb', line 398 def initialize(data) @data = data end |
Instance Attribute Details
#data ⇒ Object (readonly)
This is the data string.
403 404 405 |
# File 'lib/ctapi.rb', line 403 def data @data end |
Instance Method Details
#[](*args) ⇒ Object
Access data string by indices.
406 |
# File 'lib/ctapi.rb', line 406 def [](*args) @data[*args] end |
#inspect ⇒ Object
We use Ruby’s inspect representation to inspect the data.
409 410 411 |
# File 'lib/ctapi.rb', line 409 def inspect @data.inspect end |
#to_s ⇒ Object
To display the data, a string of the form ‘12:23:a4’ is built.
414 415 416 |
# File 'lib/ctapi.rb', line 414 def to_s @data.unpack('C*').map { |x| sprintf("%02x", x) }.join(':') end |