Class: Stupidedi::Versions::Common::ElementTypes::StringVal::Invalid

Inherits:
Stupidedi::Versions::Common::ElementTypes::StringVal show all
Defined in:
lib/stupidedi/versions/common/element_types/an.rb

Instance Attribute Summary collapse

Attributes inherited from Stupidedi::Values::SimpleElementVal

#position, #usage

Instance Method Summary collapse

Methods inherited from Stupidedi::Versions::Common::ElementTypes::StringVal

empty, #string?, #too_long?, #too_short?, value

Methods inherited from Stupidedi::Values::SimpleElementVal

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

Methods inherited from Stupidedi::Values::AbstractElementVal

#element?, #size

Methods inherited from Stupidedi::Values::AbstractVal

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

Methods included from Color

ansi, #ansi

Constructor Details

#initialize(value, usage, position) ⇒ Invalid

Returns a new instance of Invalid.


150
151
152
153
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 150

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

Instance Attribute Details

#valueObject (readonly)

Returns:

  • (Object)

148
149
150
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 148

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean

Returns:

  • (Boolean)

198
199
200
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 198

def ==(other)
  eql?(other)
end

#copy(changes = {}) ⇒ Invalid

Returns:


203
204
205
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 203

def copy(changes = {})
  self
end

#empty?Boolean

Returns:

  • (Boolean)

159
160
161
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 159

def empty?
  false
end

#inspectString

:nocov:

Returns:

  • (String)

170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 170

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("AN.invalid#{id}") + "(#{ansi.invalid(@value.inspect)})"
end

#mapInvalid

Returns:


164
165
166
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 164

def map
  self
end

#to_sString

Returns:

  • (String)

188
189
190
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 188

def to_s
  ""
end

#to_x12(truncate = true) ⇒ String

Returns:

  • (String)

193
194
195
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 193

def to_x12(truncate = true)
  ""
end

#valid?Boolean

Returns:

  • (Boolean)

155
156
157
# File 'lib/stupidedi/versions/common/element_types/an.rb', line 155

def valid?
  false
end