Class: SMPTool::Filename
- Inherits:
-
Object
- Object
- SMPTool::Filename
- Defined in:
- lib/smp_tool/filename.rb
Overview
Converts RADIX-50 <-> ASCII filenames.
Constant Summary collapse
- FN_BASE_LENGTH =
6
- FN_EXT_LENGTH =
3
- ASCII_DOT_POS =
Dot position in the printable ASCII filename.
6
- DEF_SEP_CHR =
Separation character.
"."
Instance Attribute Summary collapse
-
#ascii ⇒ Object
readonly
Returns the value of attribute ascii.
-
#radix50 ⇒ Object
readonly
Returns the value of attribute radix50.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Filename
constructor
A new instance of Filename.
-
#print_ascii(sep_chr = DEF_SEP_CHR) ⇒ Object
ASCII filename with a dot to separate extension.
Constructor Details
#initialize(options = {}) ⇒ Filename
Returns a new instance of Filename.
16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/smp_tool/filename.rb', line 16 def initialize( = {}) () if .key?(:radix50) _handle_radix_input() elsif .key?(:ascii) _handle_ascii_input() else raise ArgumentError, "Either :radix50 or :ascii must be provided" end _make_ascii_name end |
Instance Attribute Details
#ascii ⇒ Object (readonly)
Returns the value of attribute ascii.
8 9 10 |
# File 'lib/smp_tool/filename.rb', line 8 def ascii @ascii end |
#radix50 ⇒ Object (readonly)
Returns the value of attribute radix50.
8 9 10 |
# File 'lib/smp_tool/filename.rb', line 8 def radix50 @radix50 end |
Instance Method Details
#print_ascii(sep_chr = DEF_SEP_CHR) ⇒ Object
ASCII filename with a dot to separate extension.
33 34 35 |
# File 'lib/smp_tool/filename.rb', line 33 def print_ascii(sep_chr = DEF_SEP_CHR) @ascii.insert(ASCII_DOT_POS, sep_chr) end |