Class: Eddy::Models::Element::AN
- Defined in:
- lib/eddy/models/element/an.rb
Overview
Alphanumeric string including special characters
Direct Known Subclasses
Elements::E103, Elements::E116, Elements::E124, Elements::E127, Elements::E1301, Elements::E140, Elements::E142, Elements::E166, Elements::E19, Elements::E206, Elements::E207, Elements::E22, Elements::E234, Elements::E324, Elements::E326, Elements::E327, Elements::E328, Elements::E350, Elements::E352, Elements::E367, Elements::E387, Elements::E396, Elements::E480, Elements::E628, Elements::E67, Elements::E734, Elements::E751, Elements::E76, Elements::E79, Elements::E87, Elements::E93, Elements::I02, Elements::I04, Elements::I06, Elements::I07, Elements::I15
Instance Attribute Summary
Attributes inherited from Base
#description, #id, #max, #min, #name, #ref, #type
Class Method Summary collapse
-
.process_value(val, min, _max) ⇒ String
Left justify a string (
val
) tomin
.
Instance Method Summary collapse
- #initialize(min:, max:, req: nil, ref: nil, val: nil) ⇒ void constructor
- #process_value ⇒ String
- #value ⇒ String
- #value=(arg) ⇒ void
Methods inherited from Base
Constructor Details
#initialize(min:, max:, req: nil, ref: nil, val: nil) ⇒ void
13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/eddy/models/element/an.rb', line 13 def initialize( min:, max:, req: nil, ref: nil, val: nil ) @type = "AN" @min = min @max = max self.req = req self.ref = ref self.value = val end |
Class Method Details
.process_value(val, min, _max) ⇒ String
Left justify a string (val
) to min
.
62 63 64 |
# File 'lib/eddy/models/element/an.rb', line 62 def self.process_value(val, min, _max) return val.ljust(min) end |
Instance Method Details
#process_value ⇒ String
52 53 54 |
# File 'lib/eddy/models/element/an.rb', line 52 def process_value() return self.class.process_value(@val, self.min, self.max) end |
#value ⇒ String
47 48 49 |
# File 'lib/eddy/models/element/an.rb', line 47 def value() return super() end |
#value=(arg) ⇒ void
This method returns an undefined value.
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/eddy/models/element/an.rb', line 31 def value=(arg) if arg == :skip @val = :skip return end if arg.nil?() @val = arg return end raise Eddy::Errors::TypeValidationError.new(element: self, arg: arg) unless arg.is_a?(String) raise Eddy::Errors::LengthValidationError.new(element: self, arg: arg) if arg.length > self.max @val = arg end |