Class: Codabel::Type::Holder
- Inherits:
-
Codabel::Type
- Object
- Codabel::Type
- Codabel::Type::Holder
- Defined in:
- lib/codabel/type/holder.rb
Instance Method Summary collapse
Methods inherited from Codabel::Type
Instance Method Details
#to_coda(value, length) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/codabel/type/holder.rb', line 4 def to_coda(value, length) str = value.to_s return str.ljust(length, ' ') if str.empty? str = $1 if str =~ /^BE0(.*)/ check!(str.length <= length, "Value `#{value}` is too long") str.rjust(length, '0') end |