Class: Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal::Invalid

Inherits:
Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal show all
Defined in:
lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb

Instance Attribute Summary (collapse)

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Instance Method Summary (collapse)

Methods inherited from Stupidedi::Versions::FunctionalGroups::FiftyTen::ElementTypes::IdentifierVal

empty, #id?, #too_long?, #too_short?, value

Methods inherited from Stupidedi::Values::SimpleElementVal

#allowed?, #component?, #copy, #date?, #id?, #leaf?, #numeric?, #simple?, #string?, #time?

Methods inherited from Stupidedi::Values::AbstractElementVal

#element?, #size

Methods inherited from Stupidedi::Values::AbstractVal

#blank?, #characters, #component?, #composite?, #definition, #element?, #functional_group?, #interchange?, #invalid?, #loop?, #present?, #repeated?, #segment?, #separator?, #simple?, #size, #table?, #transaction_set?, #transmission?

Methods included from Color

ansi, #ansi

Constructor Details

- (Invalid) initialize(value, usage, position)



87
88
89
90
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 87

def initialize(value, usage, position)
  @value = value
  super(usage, position)
end

Instance Attribute Details

- (Object) value (readonly)



85
86
87
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 85

def value
  @value
end

Instance Method Details

- (Boolean) ==(other)



133
134
135
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 133

def ==(other)
  eql?(other) or other.nil?
end

- (Boolean) empty?



96
97
98
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 96

def empty?
  false
end

- (String) inspect



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 106

def inspect
  id = definition.bind do |d|
    "[#{'% 5s' % d.id}: #{d.name}]".bind do |s|
      if usage.forbidden?
        ansi.forbidden(s)
      elsif usage.required?
        ansi.required(s)
      else
        ansi.optional(s)
      end
    end
  end

  ansi.element("ID.invalid#{id}") << "(#{ansi.invalid(@value.inspect)})"
end

- (IdentifierVal) map



101
102
103
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 101

def map
  IdentifierVal.value(yield(nil), usage, position)
end

- (String) to_s



123
124
125
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 123

def to_s
  ""
end

- (String) to_x12(truncate = true)



128
129
130
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 128

def to_x12(truncate = true)
  ""
end

- (Boolean) valid?



92
93
94
# File 'lib/stupidedi/versions/functional_groups/005010/element_types/identifier_val.rb', line 92

def valid?
  false
end